Compare commits
No commits in common. "master" and "v1.7" have entirely different histories.
@ -1,36 +1,3 @@
|
|||||||
# Script Version 1.11
|
|
||||||
#Release Note
|
|
||||||
1.[新增功能]解耦脚本参数配置功能, 脚本配置全部放到project.config中
|
|
||||||
2.[新增功能]增加对pmbus set命令的支持
|
|
||||||
3.[新增功能]增加setup.sh, 用于一键部署脚本
|
|
||||||
4.[功能优化]代码结构目录重新归档
|
|
||||||
|
|
||||||
# Script Verison 1.10
|
|
||||||
Release Note
|
|
||||||
1.[新增功能]新增适配传感器 ina226, lm95241
|
|
||||||
2.[新增功能]增加stress压测插件, 可支持自定义压测读取功能
|
|
||||||
3.[功能优化]优化help显示功能
|
|
||||||
4.[功能优化]优化脚本交互, 增加安全性检查
|
|
||||||
5.[功能优化]插件脚本加入版本号
|
|
||||||
6.[功能优化]nicsensor配置项全部放置到 /tmp/nicsensor_config 目录下, 便于维护
|
|
||||||
7.[功能优化]version命令移除debug, n_detect的显示,仅显示脚本版本号
|
|
||||||
8.[功能优化]默认i2cbus支持在参数配置功能中通过命令配置, 可用于debug模式默认搜索
|
|
||||||
9.[功能优化]默认fru offset支持在参数配置功能中通过命令配置
|
|
||||||
|
|
||||||
# Script Verison 1.9
|
|
||||||
Release Note
|
|
||||||
1.[新增功能]添加pmbus插件功能, 可支持对VR芯片的pmbus测试
|
|
||||||
2.[功能优化]fru size支持在属性配置功能中通过命令配置大小
|
|
||||||
3.[功能优化]对于 DISABLE_DETECT 的简写由 detect 变更为 n_detect, 便于理解
|
|
||||||
4.[问题修复]修复nicsensor_v2中5280m7平台的detect功能不显示插槽信息的问题
|
|
||||||
|
|
||||||
# Script Version 1.8
|
|
||||||
Release Note
|
|
||||||
1.[新增功能]默认server type调整为auto, 通用服务器可自动检索boardid,确认服务器类型
|
|
||||||
2.[新增功能]新增set get功能, 可使用命令对配置进行修改(详见readme)
|
|
||||||
3.[问题修复]修正无法识别两位数槽位号的问题
|
|
||||||
4.[功能优化]添加脚本 nicsensor_s.sh, 是nicsensor主体功能的简化版,删去了相对次要功能来确保功能快速执行
|
|
||||||
|
|
||||||
# Script Version 1.7 20250610
|
# Script Version 1.7 20250610
|
||||||
Release Note
|
Release Note
|
||||||
1.[新增功能]预留扩展函数, 用于自定义选通网卡后的I2C操作
|
1.[新增功能]预留扩展函数, 用于自定义选通网卡后的I2C操作
|
||||||
|
|||||||
@ -108,73 +108,3 @@ detect_on_{server_name}(){
|
|||||||
}
|
}
|
||||||
``````
|
``````
|
||||||
|
|
||||||
### 修改点5-服务器auto选择配置(可选)
|
|
||||||
|
|
||||||
> [!note]
|
|
||||||
>
|
|
||||||
> script v1.8 新增特性:
|
|
||||||
>
|
|
||||||
> - server_type 配置为 auto 后可以自行搜索boardid进行匹配服务器类型(仅限通用服务器)
|
|
||||||
|
|
||||||
可以针对已知的boardid对 `try_get_server_type`函数中做针对性修改。
|
|
||||||
|
|
||||||
## 三、新增支持传感器
|
|
||||||
|
|
||||||
### 修改点1-Support_Sensor_List
|
|
||||||
|
|
||||||
``````shell
|
|
||||||
# 可以在这里添加对应的支持测试的传感器型号
|
|
||||||
Support_Sensor_List="emc1413, adc128, ina3221, ina226, tmp468, tmp112, lm95241"
|
|
||||||
``````
|
|
||||||
|
|
||||||
### 修改点2-添加sensor执行入口
|
|
||||||
|
|
||||||
``````shell
|
|
||||||
# 修改函数 start_get_sensor
|
|
||||||
start_get_sensor(){
|
|
||||||
# ... 省略部分代码
|
|
||||||
|
|
||||||
# get sensor detail value
|
|
||||||
case $sensor_type in
|
|
||||||
"emc1413")
|
|
||||||
process_emc1413
|
|
||||||
;;
|
|
||||||
# ... 省略部分代码
|
|
||||||
# 添加新增的传感器入口, 其中 process_{new_sensor} 函数是后续sensor处理的入口
|
|
||||||
"{new_sensor}")
|
|
||||||
process_{new_sensor}
|
|
||||||
;;
|
|
||||||
"chip")
|
|
||||||
process_chip
|
|
||||||
;;
|
|
||||||
"fru")
|
|
||||||
process_fru
|
|
||||||
;;
|
|
||||||
"pmbus")
|
|
||||||
process_pmbus
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
fmt_print "console" $ERROR "Unsupport Sensor Type !!! - $sensor_type"
|
|
||||||
fmt_print "console" $INFO "Support list: $Support_Sensor_List"
|
|
||||||
print_usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
``````
|
|
||||||
|
|
||||||
### 修改点3-添加sensor处理逻辑
|
|
||||||
|
|
||||||
这一部分可以参考其它的sensor处理逻辑进行开发。主要涵盖三部分内容:
|
|
||||||
|
|
||||||
- sensor是否需要初始化?(adc128通常第一次读取时需要初始化)
|
|
||||||
- 使用i2c命令读取sensor的指定寄存器值并记录下来
|
|
||||||
- 编写解析函数,将读到的寄存器值作为参数传递到解析函数,进行可视化展示
|
|
||||||
|
|
||||||
## 四、新增插件
|
|
||||||
|
|
||||||
插件一般情况下需要做preprocess,参考函数`extension_preprocess`,结合这里的功能开发插件即可。
|
|
||||||
|
|
||||||
插件执行分为两种情况:
|
|
||||||
|
|
||||||
- 如果插件需要读取网卡的某些芯片的寄存器值,那么读取过程正常导入到 `start_get_sensor`流程中。
|
|
||||||
- 插件不需要读取网卡I2C,直接在 preprocess 中完成逻辑调用即可。
|
|
||||||
|
|||||||
@ -1,195 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Desc : This script used to find pmbus code and read size
|
|
||||||
# Changelist : 2025-12-25|v0.1 Create this file
|
|
||||||
# 2026-04-17|v1.1 Add PAGE command support
|
|
||||||
|
|
||||||
# How to use this pmbus plugin?
|
|
||||||
# Follow readme.md file to use this plugin or use setup.sh to install this plugin
|
|
||||||
EXTENSION_VERSION="v1.1"
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
# Varible Define
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
operation_type=$1
|
|
||||||
str_cmd=$2
|
|
||||||
hex_cmd=0xff
|
|
||||||
read_size=0
|
|
||||||
|
|
||||||
PMBUS_BYTE=1
|
|
||||||
PMBUS_WORD=2
|
|
||||||
PMBUS_BLOCK=3
|
|
||||||
PMBUS_RAW=4
|
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
# Function Define
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
pmbus_command_help(){
|
|
||||||
echo " Extend Function - PMBUS command test"
|
|
||||||
echo " Version : $EXTENSION_VERSION"
|
|
||||||
echo " 1) Command Format : ./nicsensor.sh [slot] pmbus [slave] [command] <data>"
|
|
||||||
echo " 2) Option Detail"
|
|
||||||
echo " - [slot] : 0 1 2 3 4 5 ..."
|
|
||||||
echo " - [slave] : power manage chip slave address , please provide 7 bit address"
|
|
||||||
echo " - [command] : The pmbus command which will set to the power manage chip"
|
|
||||||
echo " - <data> : The data which will set to the power manage chip, only set operation type is set"
|
|
||||||
echo " 3) E.G. : ./nicsensor.sh pcie1 pmbus 0x60 READ_TEMPERATURE_1"
|
|
||||||
echo " : ./nicsensor.sh pcie1 pmbus 0x60 PAGE 0x00"
|
|
||||||
echo ""
|
|
||||||
echo " *****************Pmbus Support Command List********************"
|
|
||||||
echo " Command Name Code op_type Read Size "
|
|
||||||
echo " PAGE 0x00 set Byte "
|
|
||||||
echo " READ_VIN 0x88 get Word "
|
|
||||||
echo " READ_IIN 0x89 get Word "
|
|
||||||
echo " READ_VOUT 0x8b get Word "
|
|
||||||
echo " READ_IOUT 0x8c get Word "
|
|
||||||
echo " READ_TEMPERATURE_1 0x8d get Word "
|
|
||||||
echo " READ_TEMPERATURE_2 0x8e get Word "
|
|
||||||
echo " READ_TEMPERATURE_3 0x8f get Word "
|
|
||||||
echo " READ_POUT 0x96 get Word "
|
|
||||||
echo " READ_PIN 0x97 get Word "
|
|
||||||
echo " ***************************************************************"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
find_pmbus_hex_code(){
|
|
||||||
case ${str_cmd} in
|
|
||||||
"PAGE")
|
|
||||||
hex_cmd=0x00
|
|
||||||
;;
|
|
||||||
"READ_VIN")
|
|
||||||
hex_cmd=0x88
|
|
||||||
;;
|
|
||||||
"READ_IIN")
|
|
||||||
hex_cmd=0x89
|
|
||||||
;;
|
|
||||||
"READ_VOUT")
|
|
||||||
hex_cmd=0x8b
|
|
||||||
;;
|
|
||||||
"READ_IOUT")
|
|
||||||
hex_cmd=0x8c
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_1")
|
|
||||||
hex_cmd=0x8d
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_2")
|
|
||||||
hex_cmd=0x8e
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_3")
|
|
||||||
hex_cmd=0x8f
|
|
||||||
;;
|
|
||||||
"READ_POUT")
|
|
||||||
hex_cmd=0x96
|
|
||||||
;;
|
|
||||||
"READ_PIN")
|
|
||||||
hex_cmd=0x97
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
hex_cmd=0xff
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo $hex_cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
find_pmbus_operation_type(){
|
|
||||||
case ${str_cmd} in
|
|
||||||
"PAGE")
|
|
||||||
op_type="set"
|
|
||||||
;;
|
|
||||||
"READ_VIN")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_IIN")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_VOUT")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_IOUT")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_1")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_2")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_3")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_POUT")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
"READ_PIN")
|
|
||||||
op_type="get"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
op_type=""
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo $op_type
|
|
||||||
}
|
|
||||||
|
|
||||||
find_pmbus_read_size(){
|
|
||||||
case ${str_cmd} in
|
|
||||||
"PAGE")
|
|
||||||
read_size=$PMBUS_BYTE
|
|
||||||
;;
|
|
||||||
"READ_VIN")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_IIN")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_VOUT")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_IOUT")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_1")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_2")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_TEMPERATURE_3")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_POUT")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
"READ_PIN")
|
|
||||||
read_size=$PMBUS_WORD
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
read_size=0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo $read_size
|
|
||||||
}
|
|
||||||
|
|
||||||
main(){
|
|
||||||
|
|
||||||
case ${operation_type} in
|
|
||||||
"code")
|
|
||||||
find_pmbus_hex_code
|
|
||||||
;;
|
|
||||||
"operation")
|
|
||||||
find_pmbus_operation_type
|
|
||||||
;;
|
|
||||||
"size")
|
|
||||||
find_pmbus_read_size
|
|
||||||
;;
|
|
||||||
"help")
|
|
||||||
pmbus_command_help
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error command type"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
# Start Execute Script(main)
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
main
|
|
||||||
@ -1,209 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Desc: Stress test script for nicsensor
|
|
||||||
# Detail: This script will stress test the nicsensor by reading the sensor data
|
|
||||||
# and print the result to the console.
|
|
||||||
|
|
||||||
EXTENSION_VERSION="v1.0 Base Dev 1"
|
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
# Varible Define
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
Param1=$1
|
|
||||||
Param2=$2
|
|
||||||
|
|
||||||
CONFIG_DIR="/tmp/nicsensor_config"
|
|
||||||
CONFIG_NICSENSOR="${CONFIG_DIR}/stress_tool"
|
|
||||||
CONFIG_SLOT="${CONFIG_DIR}/stress_slot"
|
|
||||||
CONFIG_SENSOR="${CONFIG_DIR}/stress_sensor"
|
|
||||||
CONFIG_ROUND="${CONFIG_DIR}/stress_round"
|
|
||||||
CONFIG_INTERVAL="${CONFIG_DIR}/stress_interval"
|
|
||||||
CONFIG_SLAVE="${CONFIG_DIR}/stress_slave"
|
|
||||||
|
|
||||||
config_tool=""
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
# Function Define
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
print_usage(){
|
|
||||||
echo " Extend Function - Stress Test"
|
|
||||||
echo " Version: $EXTENSION_VERSION"
|
|
||||||
echo " 1) Description"
|
|
||||||
echo " This plugin will stress test the nicsensor by reading the sensor data"
|
|
||||||
echo " and print the result to the console."
|
|
||||||
echo " 2) Command Format : ./nicsensor.sh [slot] stress [option] [data]"
|
|
||||||
echo " 3) Option Detail"
|
|
||||||
echo " - [slot] : The nicsensor slot number"
|
|
||||||
echo " - [option] : start|show|round|tool|interval|slot|sensor|slave"
|
|
||||||
echo " - [data] : The option data"
|
|
||||||
echo " 4) Example"
|
|
||||||
echo " Case: Test PCIe1 Nic's INA3221, slave=0x42, round=1000, interval=3s"
|
|
||||||
echo " Step 1 : Set the stress test parameter"
|
|
||||||
echo " ./nicsensor.sh pcie1 stress slot pcie1"
|
|
||||||
echo " ./nicsensor.sh pcie1 stress round 1000"
|
|
||||||
echo " ./nicsensor.sh pcie1 stress interval 3"
|
|
||||||
echo " ./nicsensor.sh pcie1 stress sensor ina3221"
|
|
||||||
echo " ./nicsensor.sh pcie1 stress slave 0x42"
|
|
||||||
echo " Step 2 : Check the stress test configuration"
|
|
||||||
echo " ./nicsensor.sh pcie1 stress show"
|
|
||||||
echo " Step 3 : Start the stress test"
|
|
||||||
echo " ./nicsensor.sh pcie1 stress start"
|
|
||||||
}
|
|
||||||
|
|
||||||
set_stress_config(){
|
|
||||||
case ${Param1} in
|
|
||||||
"round")
|
|
||||||
echo "Set the stress test round to ${Param2}"
|
|
||||||
echo ${Param2} > ${CONFIG_ROUND}
|
|
||||||
;;
|
|
||||||
"interval")
|
|
||||||
echo "Set the stress test interval to ${Param2}s"
|
|
||||||
echo ${Param2} > ${CONFIG_INTERVAL}
|
|
||||||
;;
|
|
||||||
"sensor")
|
|
||||||
echo "Set the stress test sensor to ${Param2}"
|
|
||||||
echo ${Param2} > ${CONFIG_SENSOR}
|
|
||||||
;;
|
|
||||||
"slave")
|
|
||||||
echo "Set the stress test slave to ${Param2}"
|
|
||||||
echo ${Param2} > ${CONFIG_SLAVE}
|
|
||||||
;;
|
|
||||||
"slot")
|
|
||||||
echo "Set the stress test slot to ${Param2}"
|
|
||||||
echo ${Param2} > ${CONFIG_SLOT}
|
|
||||||
;;
|
|
||||||
"tool")
|
|
||||||
echo "Set the stress test tool to ${Param2}"
|
|
||||||
echo ${Param2} > ${CONFIG_NICSENSOR}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Invalid option: ${Param1}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
get_stress_all_config(){
|
|
||||||
echo "Stress Test Config:"
|
|
||||||
if [ -f ${CONFIG_NICSENSOR} ]; then
|
|
||||||
echo " Tool : $(cat ${CONFIG_NICSENSOR})"
|
|
||||||
else
|
|
||||||
echo " Tool : nicsensor.sh"
|
|
||||||
fi
|
|
||||||
if [ -f ${CONFIG_ROUND} ]; then
|
|
||||||
echo " Round : $(cat ${CONFIG_ROUND})"
|
|
||||||
else
|
|
||||||
echo " Round : Not Set"
|
|
||||||
fi
|
|
||||||
if [ -f ${CONFIG_INTERVAL} ]; then
|
|
||||||
echo " Interval: $(cat ${CONFIG_INTERVAL})s"
|
|
||||||
else
|
|
||||||
echo " Interval: Not Set"
|
|
||||||
fi
|
|
||||||
if [ -f ${CONFIG_SLOT} ]; then
|
|
||||||
echo " Slot : $(cat ${CONFIG_SLOT})"
|
|
||||||
else
|
|
||||||
echo " Slot : Not Set"
|
|
||||||
fi
|
|
||||||
if [ -f ${CONFIG_SENSOR} ]; then
|
|
||||||
echo " Sensor : $(cat ${CONFIG_SENSOR})"
|
|
||||||
else
|
|
||||||
echo " Sensor : Not Set"
|
|
||||||
fi
|
|
||||||
if [ -f ${CONFIG_SLAVE} ]; then
|
|
||||||
echo " Slave : $(cat ${CONFIG_SLAVE})"
|
|
||||||
else
|
|
||||||
echo " Slave : Not Set"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
start_stress_test(){
|
|
||||||
# nicsensor tool check
|
|
||||||
if [ -f ${CONFIG_NICSENSOR} ]; then
|
|
||||||
config_tool=$(cat ${CONFIG_NICSENSOR})
|
|
||||||
else
|
|
||||||
config_tool="/extlog/nicsensor/nicsensor.sh"
|
|
||||||
fi
|
|
||||||
if [ ! -f "${config_tool}" ]; then
|
|
||||||
echo "Error: ${config_tool} tool not found"
|
|
||||||
echo "Info : Please check the nicsensor tool path and name"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# option check
|
|
||||||
if [ ! -f ${CONFIG_ROUND} ]; then
|
|
||||||
echo "Error: Round is not set"
|
|
||||||
echo "Info : Please set the stress test round first, use command: ${config_tool} [slot] stress round [data]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ ! -f ${CONFIG_INTERVAL} ]; then
|
|
||||||
echo "Error: Interval is not set"
|
|
||||||
echo "Info : Please set the stress test interval first, use command: ${config_tool} [slot] stress interval [data]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ ! -f ${CONFIG_SLOT} ]; then
|
|
||||||
echo "Error: Slot is not set"
|
|
||||||
echo "Info : Please set the stress test slot first, use command: ${config_tool} [slot] stress slot [data]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ ! -f ${CONFIG_SENSOR} ]; then
|
|
||||||
echo "Error: Sensor is not set"
|
|
||||||
echo "Info : Please set the stress test sensor first, use command: ${config_tool} [slot] stress sensor [data]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ ! -f ${CONFIG_SLAVE} ]; then
|
|
||||||
echo "Error: Slave is not set"
|
|
||||||
echo "Info : Please set the stress test slave first, use command: ${config_tool} [slot] stress slave [data]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# start stress test
|
|
||||||
echo "Stress Test Config Info:"
|
|
||||||
config_round=$(cat ${CONFIG_ROUND})
|
|
||||||
config_interval=$(cat ${CONFIG_INTERVAL})
|
|
||||||
config_slot=$(cat ${CONFIG_SLOT})
|
|
||||||
config_sensor=$(cat ${CONFIG_SENSOR})
|
|
||||||
config_slave=$(cat ${CONFIG_SLAVE})
|
|
||||||
echo " Round : ${config_round}"
|
|
||||||
echo " Interval: ${config_interval}s"
|
|
||||||
echo " Slot : ${config_slot}"
|
|
||||||
echo " Sensor : ${config_sensor}"
|
|
||||||
echo " Slave : ${config_slave}"
|
|
||||||
|
|
||||||
run_count=1
|
|
||||||
while [ ${run_count} -le ${config_round} ]; do
|
|
||||||
echo ""
|
|
||||||
timestamp=$(date +"%Y-%m-%dT%H:%M:%S")
|
|
||||||
echo "====== ${timestamp}, Run Count: ${run_count}"
|
|
||||||
exec_cmd="${config_tool} ${config_slot} ${config_sensor} ${config_slave}"
|
|
||||||
${exec_cmd}
|
|
||||||
sleep ${config_interval}
|
|
||||||
run_count=$((run_count+1))
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "==========================================="
|
|
||||||
echo " Stress Test Completed"
|
|
||||||
}
|
|
||||||
|
|
||||||
main(){
|
|
||||||
cmd=${Param1}
|
|
||||||
case ${cmd} in
|
|
||||||
"start")
|
|
||||||
echo "Start the stress test"
|
|
||||||
start_stress_test
|
|
||||||
;;
|
|
||||||
"show")
|
|
||||||
echo "Show the stress test configuration"
|
|
||||||
get_stress_all_config
|
|
||||||
;;
|
|
||||||
"help")
|
|
||||||
print_usage
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Set Stress Config"
|
|
||||||
set_stress_config
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
# Start Execute Script(main)
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
main
|
|
||||||
1447
nicsensor.sh
1447
nicsensor.sh
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
script_version="v2.0"
|
script_version="v2.0"
|
||||||
default_server_type="5688m7"
|
server_type="5688m7"
|
||||||
server_platform="m7"
|
server_platform="m7"
|
||||||
|
|
||||||
slot_name=$1
|
slot_name=$1
|
||||||
@ -11,47 +11,13 @@ param_num=$#
|
|||||||
|
|
||||||
nic_type=""
|
nic_type=""
|
||||||
slot_id=""
|
slot_id=""
|
||||||
server_type=""
|
|
||||||
|
|
||||||
path=`pwd`
|
path=`pwd`
|
||||||
server_script=""
|
server_script="${path}/platform_${server_type}.sh"
|
||||||
sensor_script=""
|
sensor_script="${path}/plugin_${sensor_type}.sh"
|
||||||
i2c_script="${path}/i2c_${server_platform}.sh"
|
i2c_script="${path}/i2c_${server_platform}.sh"
|
||||||
fmt_print="${path}/format_print.sh"
|
fmt_print="${path}/format_print.sh"
|
||||||
|
|
||||||
# According to boardid, parse server_type
|
|
||||||
# Only valid on Gen 7 series
|
|
||||||
try_get_server_type(){
|
|
||||||
if [ -e "/tmp/ns_servertype" ];then
|
|
||||||
server_type=`cat /tmp/ns_servertype`
|
|
||||||
else
|
|
||||||
boardid=`cat /proc/cmdline | awk -F 'boardid=' '{split($2, a," "); print a[1]}'`
|
|
||||||
|
|
||||||
if [ "$boardid" = "" ];then
|
|
||||||
server_type=$default_server_type
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ $boardid -eq 130 ];then
|
|
||||||
server_type="5280m7"
|
|
||||||
elif [ $boardid -eq 150 ];then
|
|
||||||
server_type="5468m7"
|
|
||||||
elif [ $boardid -eq 152 ];then
|
|
||||||
server_type="5688m7"
|
|
||||||
else
|
|
||||||
server_type=$default_server_type
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $server_type > /tmp/ns_servertype
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
script_info_load(){
|
|
||||||
path=`pwd`
|
|
||||||
server_script="${path}/platform_${server_type}.sh"
|
|
||||||
sensor_script="${path}/plugin_${sensor_type}.sh"
|
|
||||||
}
|
|
||||||
|
|
||||||
print_helper(){
|
print_helper(){
|
||||||
echo "======>>> nicsensor Scirpt Usage <<<======"
|
echo "======>>> nicsensor Scirpt Usage <<<======"
|
||||||
echo "Genenral Usage : ./nicsensor.sh [slot] [sensor] [i2c slave]"
|
echo "Genenral Usage : ./nicsensor.sh [slot] [sensor] [i2c slave]"
|
||||||
@ -86,12 +52,9 @@ conf_pre_check(){
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If action is detect , skip this check
|
if [ ! -e $sensor_script ];then
|
||||||
if [ $param_num -gt 3 ];then
|
$fmt_print "console" "Error" "Sensor Script $sensor_script not exist! Maybe unsupport for now!"
|
||||||
if [ ! -e $sensor_script ];then
|
exit 1
|
||||||
$fmt_print "console" "Error" "Sensor Script $sensor_script not exist! Maybe unsupport for now!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e $i2c_script ];then
|
if [ ! -e $i2c_script ];then
|
||||||
@ -139,20 +102,13 @@ start_sensor_reading(){
|
|||||||
|
|
||||||
$sensor_script "read" "${i2c_bus}" "${chip_slave}" "${server_platform}" "${server_type}"
|
$sensor_script "read" "${i2c_bus}" "${chip_slave}" "${server_platform}" "${server_type}"
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_exec_hook(){
|
|
||||||
# init debug log
|
|
||||||
if [ -e "/tmp/nicsensor_debug.log" ];then
|
|
||||||
rm /tmp/nicsensor_debug.log
|
|
||||||
fi
|
|
||||||
try_get_server_type
|
|
||||||
script_info_load
|
|
||||||
conf_pre_check
|
|
||||||
}
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Start Execute Script
|
# Start Execute Script
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
pre_exec_hook
|
# init debug log
|
||||||
|
if [ -e "/tmp/nicsensor_debug.log" ];then
|
||||||
|
rm /tmp/nicsensor_debug.log
|
||||||
|
fi
|
||||||
|
|
||||||
# check if is detect option
|
# check if is detect option
|
||||||
if [ "$1" = "detect" ];then
|
if [ "$1" = "detect" ];then
|
||||||
@ -160,6 +116,8 @@ if [ "$1" = "detect" ];then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
conf_pre_check
|
||||||
|
|
||||||
parse_slot_name
|
parse_slot_name
|
||||||
|
|
||||||
i2c_bus=`connect_i2c`
|
i2c_bus=`connect_i2c`
|
||||||
@ -4,9 +4,6 @@ action=$1
|
|||||||
nic_type=$2
|
nic_type=$2
|
||||||
slot_id=$3
|
slot_id=$3
|
||||||
|
|
||||||
# Param: i2c_command only valid for function 'send'
|
|
||||||
i2c_command=$4
|
|
||||||
|
|
||||||
path=`pwd`
|
path=`pwd`
|
||||||
i2c_script="${path}/i2c_m7.sh"
|
i2c_script="${path}/i2c_m7.sh"
|
||||||
fmt_print="${path}/format_print.sh"
|
fmt_print="${path}/format_print.sh"
|
||||||
@ -128,9 +125,9 @@ build_i2c_connect(){
|
|||||||
# @Param5 pcie slot number
|
# @Param5 pcie slot number
|
||||||
do_i2c_detect(){
|
do_i2c_detect(){
|
||||||
if [ "${nic_type}" == "ocp" ];then
|
if [ "${nic_type}" == "ocp" ];then
|
||||||
$fmt_print "console" "Info" "OCP slot $5 : bus$1 9548channel$4"
|
$fmt_print "log" "Info" "OCP slot $5 : bus$1 9548channel$4"
|
||||||
else
|
else
|
||||||
$fmt_print "console" "Info" "PCIe slot $5 : bus$1 9548channel$4"
|
$fmt_print "log" "Info" "PCIe slot $5 : bus$1 9548channel$4"
|
||||||
fi
|
fi
|
||||||
i2ctransfer -y $1 w1@$2 $3
|
i2ctransfer -y $1 w1@$2 $3
|
||||||
i2cdetect -y $1
|
i2cdetect -y $1
|
||||||
@ -170,18 +167,6 @@ reset_all_pca9548(){
|
|||||||
$fmt_print "log" "Info" "[platform_5280m7] Bypass reset pca9548"
|
$fmt_print "log" "Info" "[platform_5280m7] Bypass reset pca9548"
|
||||||
}
|
}
|
||||||
|
|
||||||
send_i2c_command(){
|
|
||||||
$fmt_print "log" "Info" "[platform_5280m7] Send an i2c command"
|
|
||||||
|
|
||||||
set_i2c_config
|
|
||||||
if [ $is_have_pca9641 -eq 1 ];then
|
|
||||||
get_pca9641_control
|
|
||||||
fi
|
|
||||||
select_pca9548_channel
|
|
||||||
|
|
||||||
$i2c_command
|
|
||||||
}
|
|
||||||
|
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
# Start Execute Script
|
# Start Execute Script
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
@ -195,9 +180,6 @@ case "${action}" in
|
|||||||
"reset")
|
"reset")
|
||||||
reset_all_pca9548
|
reset_all_pca9548
|
||||||
;;
|
;;
|
||||||
"send")
|
|
||||||
send_i2c_command
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
$fmt_print "console" "Error" "[platform_5280m7] Unspecified Operation : $action"
|
$fmt_print "console" "Error" "[platform_5280m7] Unspecified Operation : $action"
|
||||||
exit 1
|
exit 1
|
||||||
@ -4,9 +4,6 @@ action=$1
|
|||||||
nic_type=$2
|
nic_type=$2
|
||||||
slot_id=$3
|
slot_id=$3
|
||||||
|
|
||||||
# Param: i2c_command only valid for function 'send'
|
|
||||||
i2c_command=$4
|
|
||||||
|
|
||||||
path=`pwd`
|
path=`pwd`
|
||||||
i2c_script="${path}/i2c_m7.sh"
|
i2c_script="${path}/i2c_m7.sh"
|
||||||
fmt_print="${path}/format_print.sh"
|
fmt_print="${path}/format_print.sh"
|
||||||
@ -159,18 +156,6 @@ reset_all_pca9548(){
|
|||||||
i2ctransfer -y 12 w1@0x72 0x00
|
i2ctransfer -y 12 w1@0x72 0x00
|
||||||
}
|
}
|
||||||
|
|
||||||
send_i2c_command(){
|
|
||||||
$fmt_print "log" "Info" "[platform_5280m7] Send an i2c command"
|
|
||||||
|
|
||||||
set_i2c_config
|
|
||||||
if [ $is_have_pca9641 -eq 1 ];then
|
|
||||||
get_pca9641_control
|
|
||||||
fi
|
|
||||||
select_pca9548_channel
|
|
||||||
|
|
||||||
$i2c_command
|
|
||||||
}
|
|
||||||
|
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
# Start Execute Script
|
# Start Execute Script
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
@ -184,9 +169,6 @@ case "${action}" in
|
|||||||
"reset")
|
"reset")
|
||||||
reset_all_pca9548
|
reset_all_pca9548
|
||||||
;;
|
;;
|
||||||
"send")
|
|
||||||
send_i2c_command
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
$fmt_print "console" "Error" "[platform_5688m7] Unspecified Operation : $action"
|
$fmt_print "console" "Error" "[platform_5688m7] Unspecified Operation : $action"
|
||||||
exit 1
|
exit 1
|
||||||
@ -89,10 +89,6 @@ check_adc128_init(){
|
|||||||
# @Param 3 customization channel name
|
# @Param 3 customization channel name
|
||||||
# @Param 4 division factor
|
# @Param 4 division factor
|
||||||
convert_adc128_data(){
|
convert_adc128_data(){
|
||||||
if [ "$3" = "disable" ];then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# remove data prefix '0x'
|
# remove data prefix '0x'
|
||||||
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
||||||
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
||||||
@ -46,10 +46,6 @@ print_help(){
|
|||||||
# @Param2 emc1413 data low 8bit
|
# @Param2 emc1413 data low 8bit
|
||||||
# @Param3 customization channel name
|
# @Param3 customization channel name
|
||||||
convert_emc1413_data(){
|
convert_emc1413_data(){
|
||||||
if [ "$3" = "disable" ];then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# remove data prefix '0x'
|
# remove data prefix '0x'
|
||||||
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
||||||
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
||||||
@ -68,10 +68,6 @@ print_help(){
|
|||||||
# @Param6 customization channel name
|
# @Param6 customization channel name
|
||||||
convert_ina3221_data(){
|
convert_ina3221_data(){
|
||||||
|
|
||||||
if [ "$6" = "disable" ];then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
||||||
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
||||||
merge_value="${hex_value1}${hex_value2}"
|
merge_value="${hex_value1}${hex_value2}"
|
||||||
@ -36,10 +36,6 @@ print_help(){
|
|||||||
# @Param2 tmp112 data low 8bit
|
# @Param2 tmp112 data low 8bit
|
||||||
# @Param3 customization sensor name
|
# @Param3 customization sensor name
|
||||||
convert_tmp112_data(){
|
convert_tmp112_data(){
|
||||||
if [ "$3" = "disable" ];then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
||||||
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
||||||
merge_value="${hex_value1}${hex_value2}"
|
merge_value="${hex_value1}${hex_value2}"
|
||||||
@ -47,10 +47,6 @@ print_help(){
|
|||||||
# @Param2 tmp468 data high 8bit
|
# @Param2 tmp468 data high 8bit
|
||||||
# @Param3 customization channel name
|
# @Param3 customization channel name
|
||||||
convert_tmp468_data(){
|
convert_tmp468_data(){
|
||||||
if [ "$3" = "disable" ];then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
|
||||||
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
|
||||||
merge_value="${hex_value1}${hex_value2}"
|
merge_value="${hex_value1}${hex_value2}"
|
||||||
@ -1,56 +0,0 @@
|
|||||||
# ADC128 Division factor
|
|
||||||
votage_division_factor_0="1"
|
|
||||||
votage_division_factor_1="1"
|
|
||||||
votage_division_factor_2="1"
|
|
||||||
votage_division_factor_3="0.8"
|
|
||||||
votage_division_factor_4="0.6"
|
|
||||||
votage_division_factor_5="0.6"
|
|
||||||
votage_division_factor_6="0.2326"
|
|
||||||
votage_division_factor_7="1"
|
|
||||||
|
|
||||||
# ADC128 channel name
|
|
||||||
ADC128_Channel0_name="Channel0"
|
|
||||||
ADC128_Channel1_name="Channel1"
|
|
||||||
ADC128_Channel2_name="Channel2"
|
|
||||||
ADC128_Channel3_name="Channel3"
|
|
||||||
ADC128_Channel4_name="Channel4"
|
|
||||||
ADC128_Channel5_name="Channel5"
|
|
||||||
ADC128_Channel6_name="Channel6"
|
|
||||||
ADC128_Channel7_name="Channel7"
|
|
||||||
|
|
||||||
# INA3221 shunt resistor(unit: mohm)
|
|
||||||
shunt_resistor_0="2"
|
|
||||||
shunt_resistor_1="2"
|
|
||||||
shunt_resistor_2="5"
|
|
||||||
|
|
||||||
# INA3221 channel name
|
|
||||||
INA3221_Channel0_name="Channel0"
|
|
||||||
INA3221_Channel1_name="Channel1"
|
|
||||||
INA3221_Channel2_name="Channel2"
|
|
||||||
|
|
||||||
# EMC1413 channel name
|
|
||||||
EMC1413_Channel0_name="Channel0"
|
|
||||||
EMC1413_Channel1_name="Channel1"
|
|
||||||
EMC1413_Channel2_name="Channel2"
|
|
||||||
|
|
||||||
# TMP468 channel name
|
|
||||||
TMP468_Channel0_name="Local"
|
|
||||||
TMP468_Channel1_name="Remote1"
|
|
||||||
TMP468_Channel2_name="Remote2"
|
|
||||||
TMP468_Channel3_name="Remote3"
|
|
||||||
TMP468_Channel4_name="Remote4"
|
|
||||||
TMP468_Channel5_name="Remote5"
|
|
||||||
TMP468_Channel6_name="Remote6"
|
|
||||||
TMP468_Channel7_name="Remote7"
|
|
||||||
TMP468_Channel8_name="Remote8"
|
|
||||||
|
|
||||||
# TMP112 sensor name
|
|
||||||
TMP112_Sensor_name="Temperature"
|
|
||||||
|
|
||||||
# INA226 channel name
|
|
||||||
INA226_Channel0_name="Channel0"
|
|
||||||
|
|
||||||
# LM95241 channel name
|
|
||||||
LM95241_Local_name="Local"
|
|
||||||
LM95241_Remote1_name="Remote1"
|
|
||||||
LM95241_Remote2_name="Remote2"
|
|
||||||
389
readme.md
389
readme.md
@ -3,125 +3,74 @@
|
|||||||
> 本说明仅针对 nicsensorv1.x系列脚本
|
> 本说明仅针对 nicsensorv1.x系列脚本
|
||||||
> 1.x系列工具本体: [nicsensor.sh](./nicsensor.sh)
|
> 1.x系列工具本体: [nicsensor.sh](./nicsensor.sh)
|
||||||
|
|
||||||
## 快速使用
|
|
||||||
|
|
||||||
### 脚本部署
|
|
||||||
|
|
||||||
> [!Important]
|
|
||||||
>
|
|
||||||
> 1.11 版本的nicsensor支持了 `setup.sh` 脚本。
|
|
||||||
|
|
||||||
操作步骤:
|
|
||||||
|
|
||||||
1. 将整个压缩包nicsensor-{version}.zip在本地解压
|
|
||||||
2. 如果针对板卡硬件参数需要修改,对应修改 `project.config` 文件(无需修改`nicsensor.sh`本体)
|
|
||||||
3. 使用scp命令将代码包传递到服务器BMC上:`scp -r nicsensor/ sysadmin@{bmc ip}:/tmp/`
|
|
||||||
4. ssh登录进入服务器BMC,后执行 `/tmp/nicsensor/setup.sh` 即可完成工具初始化
|
|
||||||
|
|
||||||
完成上述工作后即可正常使用该工具,脚本默认目录:`/extlog/nicsensor/nicsensor.sh`
|
|
||||||
|
|
||||||
### 脚本命令
|
|
||||||
|
|
||||||
工具Usage :`./nicsensor.sh help`
|
|
||||||
|
|
||||||
工具版本查询 :`./nicsensor.sh version`
|
|
||||||
|
|
||||||
读取传感器:`./nicsensor.sh pcie0 ina3221 0x42` (读取PCIE_0 上网卡的 INA3221 传感器,slave地址0x42)
|
|
||||||
|
|
||||||
## 目录
|
## 目录
|
||||||
|
|
||||||
- [nicsensor工具使用说明](#nicsensor工具使用说明)
|
- [nicsensor工具使用说明](#nicsensor工具使用说明)
|
||||||
- [目录](#目录)
|
- [目录](#目录)
|
||||||
- [1.简介](#1_简介)
|
- [1 简介](#1_简介)
|
||||||
- [2.使用方法](#2_使用方法)
|
- [2 使用方法](#2_使用方法)
|
||||||
- [2.1 传感器读取](#2_1_传感器读取)
|
- [2.1 传感器读取](#2_1_传感器读取)
|
||||||
- [2.2 FRU读写](#2_2_fru读写)
|
- [2.2 FRU相关操作](#2_2_fru相关操作)
|
||||||
- [2.3 命令透传](#2_3_命令透传)
|
- [2.3 命令透传](#2_3_命令透传)
|
||||||
- [2.4 服务器网卡通道I2C信息扫描](#2_4_服务器网卡通道I2C信息扫描)
|
- [2.4 插槽I2C信息遍历](#2_4_插槽i2c信息遍历)
|
||||||
- [2.5 调试模式](#2_5_调试模式)
|
- [2.5 调试模式使用](#2_5_调试模式使用)
|
||||||
- [2.6 扩展功能(已停用)](#2_6_扩展功能)
|
- [2.6 扩展功能](#2_6_扩展功能)
|
||||||
- [2.7 参数配置](#2_7_参数配置)
|
- [3 常见问题](#3_常见问题)
|
||||||
- [2.8 PMBUS功能测试](#2_8_pmbus功能)
|
|
||||||
- [2.9 压力测试stress](#2_9_压力测试stress)
|
|
||||||
- [3.常见问题](#3_常见问题)
|
|
||||||
- [3.1 ADC128传感器读值为0](#3_1_adc128传感器读值为0)
|
- [3.1 ADC128传感器读值为0](#3_1_adc128传感器读值为0)
|
||||||
- [3.2 脚本执行时出现大批量语法错误](#3_2_脚本执行时出现大批量语法错误)
|
- [3.2 脚本执行时出现大批量语法错误](#3_2_脚本执行时出现大批量语法错误)
|
||||||
- [3.3 传感器读值不正确](#3_3_传感器读值不正确)
|
- [4 附属工具](#4_附属工具)
|
||||||
- [3.4 插件升级](#3_4_插件升级)
|
|
||||||
- [4.附属工具](#4_附属工具)
|
|
||||||
- [4.1 FruParse](#4_1_fruparse)
|
- [4.1 FruParse](#4_1_fruparse)
|
||||||
- [4.2 nicsensor\_s(已停用)](#4_2_nicsensor_s)
|
- [5 关于nicsensor_v2](#5_关于nicsensor_v2)
|
||||||
- [5.关于nicsensor\_v2](#5_关于nicsensor_v2)
|
- [6 附录](#6_附录)
|
||||||
- [6.附录](#6_附录)
|
|
||||||
- [6.1 Project变量说明](#6_1_project变量说明)
|
- [6.1 Project变量说明](#6_1_project变量说明)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 1_简介
|
## 1_简介
|
||||||
|
|
||||||
nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于测试网卡I2C功能的工具。
|
nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于测试网卡I2C功能的工具。
|
||||||
|
|
||||||
**当前支持的功能有:**
|
**当前支持的功能有:**
|
||||||
|
|
||||||
- 读取网卡上的I2C传感器
|
- 读取网卡上的I2C传感器
|
||||||
- 读取并修改网卡上的FRU
|
- 读取并修改网卡上的FRU
|
||||||
- 透传I2C命令到网卡的芯片上
|
- 透传I2C命令到网卡的芯片上
|
||||||
- 遍历服务器上的PCIE插槽的I2C信息
|
- 遍历服务器上的PCIE插槽的I2C信息
|
||||||
- 部分服务器类型支持读取OCP卡
|
- 部分服务器类型支持读取OCP卡
|
||||||
- 支持记录单次运行日志
|
|
||||||
- 支持测试PMBUS功能**(new)**
|
|
||||||
- 支持进行压力测试**(new)**
|
|
||||||
|
|
||||||
**当前支持测试的传感器类型**
|
**当前支持测试的传感器类型**
|
||||||
|
|
||||||
- adc128
|
- adc128
|
||||||
- ina3221
|
- ina3221
|
||||||
- ina226**(new)**
|
|
||||||
- emc1413
|
- emc1413
|
||||||
- tmp468
|
- tmp468
|
||||||
- tmp112
|
- tmp112
|
||||||
- lm95241**(new)**
|
|
||||||
|
> [!tip]
|
||||||
|
> 每次执行脚本都可以在 `/tmp/nicsensor_debug.log` 查询详细的命令执行记录
|
||||||
|
|
||||||
## 2_使用方法
|
## 2_使用方法
|
||||||
|
|
||||||
> [!warning]
|
> [!warning]
|
||||||
> ~~在使用时针对网卡的硬件特性需要定制化修改脚本的 Project Varible~~ ,
|
> 在使用时针对网卡的硬件特性需要定制化修改脚本的 `Project Varible` ,变量的对应关系及说明见[Project变量说明](#6_1_project变量说明)
|
||||||
>
|
|
||||||
> V1.11之后的脚本:修改 project.config即可,无需修改脚本本体
|
|
||||||
>
|
|
||||||
> 变量的对应关系及说明见[Project变量说明](#6_1_project变量说明)
|
|
||||||
|
|
||||||
### 2_1_传感器读取
|
### 2_1_传感器读取
|
||||||
|
|
||||||
**命令格式**
|
**命令格式**
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
./nicsensor.sh <pcie_slot> <sensor_tpye> <sensor_slave>
|
./nicsensor.sh <pcie_slot> <sensor_tpye> <sensor_slave>
|
||||||
```
|
```
|
||||||
**参数说明**
|
**参数说明**
|
||||||
|
- `pcie slot`:网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型
|
||||||
| Properties | type | 说明 |
|
- `sensor type`:传感器类型
|
||||||
| -------------- | ------- | ------------------------------------------------------------ |
|
- `sensor slave`:传感器的slave地址
|
||||||
| `pcie slot` | string | 网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型 |
|
|
||||||
| `sensor type` | string | 传感器类型 |
|
|
||||||
| `sensor slave` | hex num | 传感器的slave地址(7 bit) |
|
|
||||||
|
|
||||||
**命令示例**
|
**命令示例**
|
||||||
``` shell
|
``` shell
|
||||||
# 读取pcie2槽位上的adc128的信息, adc128芯片的地址为0x1f(7bit)
|
# 读取pcie2槽位上的adc128的信息, adc128芯片的地址为0x1f(7bit)
|
||||||
./nicsensor.sh pcie2 adc128 0x1f
|
./nicsensor.sh pcie2 adc128 0x1f
|
||||||
# 读取pcie3槽位上的ina3221的信息, ina3221芯片的地址为0x40(7bit)
|
|
||||||
./nicsensor.sh 3 ina3221 0x40
|
|
||||||
# 读取ocp0槽位上的tmp112的信息, tmp112芯片的地址为0x48(7bit)
|
|
||||||
./nicsensor.sh ocp0 tmp112 0x48
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 2_2_FRU相关操作
|
||||||
|
|
||||||
### 2_2_FRU读写
|
|
||||||
|
|
||||||
> [!warning]
|
> [!warning]
|
||||||
> 在写入网卡FRU操作时,受限于服务器PCA9641的影响,**建议**将服务器关机后执行
|
> 在写入网卡FRU操作时,受限于服务器PCA9641的影响,需要将服务器关机后执行
|
||||||
|
|
||||||
**命令格式**
|
**命令格式**
|
||||||
``` shell
|
``` shell
|
||||||
@ -133,12 +82,9 @@ nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于
|
|||||||
```
|
```
|
||||||
|
|
||||||
**参数说明**
|
**参数说明**
|
||||||
|
- `pcie slot`:网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型
|
||||||
| Properties | type | 说明 |
|
- `eeprom slave`: FRU所在的eeprom芯片的slave地址
|
||||||
| -------------- | ------- | ------------------------------------------------------------ |
|
- `filename`: 仅在写入FRU时提供, 要写入的FRU bin文件
|
||||||
| `pcie slot` | string | 网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型 |
|
|
||||||
| `eeprom slave` | hex num | FRU所在的eeprom芯片的slave地址(7 bit) |
|
|
||||||
| `filename` | string | 仅在写入FRU时提供, 要写入的FRU bin文件路径 |
|
|
||||||
|
|
||||||
**命令示例**
|
**命令示例**
|
||||||
``` shell
|
``` shell
|
||||||
@ -149,24 +95,16 @@ nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于
|
|||||||
./nicsensor.sh pcie2 fru 0x50 write fru.bin
|
./nicsensor.sh pcie2 fru 0x50 write fru.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 2_3_命令透传
|
### 2_3_命令透传
|
||||||
|
|
||||||
提供对芯片直接执行i2c命令的能力,通常用于访问网卡核心芯片如FPGA,Nic Controller等。
|
|
||||||
|
|
||||||
**命令格式**
|
**命令格式**
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
./nicsensor.sh <pcie_slot> chip <chip slave> <command>
|
./nicsensor.sh <pcie_slot> chip <chip slave> <command>
|
||||||
```
|
```
|
||||||
**参数说明**
|
**参数说明**
|
||||||
|
- `pcie slot`:网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型
|
||||||
| Properties | type | 说明 |
|
- `chip slave`: 芯片的slave地址
|
||||||
| ------------ | ------- | ------------------------------------------------------------ |
|
- `command`: 要透传执行的I2C命令
|
||||||
| `pcie slot` | string | 网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型 |
|
|
||||||
| `chip slave` | hex num | 芯片的slave地址(7 bit) |
|
|
||||||
| `command` | string | 要透传执行的I2C命令 |
|
|
||||||
|
|
||||||
**命令示例**
|
**命令示例**
|
||||||
``` shell
|
``` shell
|
||||||
@ -174,9 +112,7 @@ nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于
|
|||||||
./nicsensor.sh pcie2 chip 0x11 "i2ctransfer -y 12 w2@0x11 0x00 0x00 r2"
|
./nicsensor.sh pcie2 chip 0x11 "i2ctransfer -y 12 w2@0x11 0x00 0x00 r2"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 2_4_插槽I2C信息遍历
|
||||||
|
|
||||||
### 2_4_服务器网卡通道I2C信息扫描
|
|
||||||
|
|
||||||
**命令格式**
|
**命令格式**
|
||||||
``` shell
|
``` shell
|
||||||
@ -191,270 +127,97 @@ nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于
|
|||||||
./nicsensor.sh detect pcie
|
./nicsensor.sh detect pcie
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 2_5_调试模式使用
|
||||||
|
|
||||||
|
> 关联变量 `DEBUG_MODE`, 启用调试模式时需要将该变量的值配置为1
|
||||||
### 2_5_调试模式
|
|
||||||
|
|
||||||
如果不需要借助脚本来选通服务器上对应的channel, 仅需要做传感器数值测试, 可以启用调试模式。
|
如果不需要借助脚本来选通服务器上对应的channel, 仅需要做传感器数值测试, 可以启用调试模式。
|
||||||
在调试模式下, 脚本不会执行选通PCA9641以及PCA9546/9548的操作。仅直接测试传感器。
|
在调试模式下, 脚本不会执行选通PCA9641以及PCA9546/9548的操作。仅直接测试传感器。因此,需要手动调整两个变量
|
||||||
|
- `DEBUG_MODE`
|
||||||
**开启调试模式**
|
- `i2c_bus`
|
||||||
|
|
||||||
``````sh
|
|
||||||
./nicsensor.sh set debug 1
|
|
||||||
``````
|
|
||||||
|
|
||||||
**关闭调试模式**
|
|
||||||
|
|
||||||
``````sh
|
|
||||||
./nicsensor.sh set debug 0
|
|
||||||
``````
|
|
||||||
|
|
||||||
|
|
||||||
|
> 关联变量 `DISABLE_DETECT`, 启用时配置为1, 将不会在切换PCA9641和PCA9548时进行i2cdetect
|
||||||
|
|
||||||
### 2_6_扩展功能
|
### 2_6_扩展功能
|
||||||
|
|
||||||
该功能已在v1.11之后脚本舍弃 ,如果需要对脚本进行功能性的自定义修改,参照文档[扩展说明](docs/扩展脚本说明.md)
|
脚本中预留了函数 `handle_reserve` 用于扩展功能。针对有特殊需求的项目可能会使用。
|
||||||
|
|
||||||
~~脚本中预留了函数 `handle_reserve` 用于扩展功能。针对有特殊需求的项目可能会使用。~~
|
|
||||||
|
|
||||||
~~在 `handle_reserve` 中可以自定义需要对网卡实现的功能。在调用该函数之前脚本会将 PCA9641及PCA9548选通。扩展功能时无需考虑PCA9641和PCA9548的状态。~~
|
|
||||||
|
|
||||||
### 2_7_参数配置
|
|
||||||
|
|
||||||
可以通过一组名为 `get/set` 的指令对脚本中的如下变量做即时修改而无需修改脚本(下电后恢复默认)。支持修改的变量如下:
|
|
||||||
| Properties | 对应脚本变量 | 说明 |
|
|
||||||
| ------------ | ---------------- | ---------------------------------------- |
|
|
||||||
| `server` | `server_type` | 脚本应用的服务器类型 |
|
|
||||||
| `debug` | `DEBUG_MODE` | 是否启用调试模式 |
|
|
||||||
| `n_detect` | `DISABLE_DETECT` | 是否禁止执行时的i2c detect操作 |
|
|
||||||
| `fru_size` | `fru_size` | 默认fru的读取字节数 |
|
|
||||||
| `fru_offset` | `fru_offset` | 默认fru在eeprom的起始偏移地址 |
|
|
||||||
| `i2cbus` | `i2c_bus` | 默认的i2c bus,通常需要搭配debug一起使用 |
|
|
||||||
|
|
||||||
**命令格式**
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
./nicsensor.sh <get/set> <property> <value>
|
|
||||||
```
|
|
||||||
|
|
||||||
**命令示例**
|
|
||||||
``` shell
|
|
||||||
./nicsensor.sh set server 5280m7
|
|
||||||
|
|
||||||
./nicsneosr.sh get debug
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 2_8_PMBUS功能
|
|
||||||
|
|
||||||
> [!warning]
|
|
||||||
> 支持的脚本版本:v1.9及以上
|
|
||||||
> ~~PMBUS功能属于额外的功能,需要将 [pmbus_cmd_list.sh](./pmbus_cmd_list.sh) 拷贝到和nicsensor脚本相同的目录。~~
|
|
||||||
> ~~如果不添加该脚本, 该功能无法正常使用~~
|
|
||||||
>
|
|
||||||
> v1.11版本执行setup.sh会自动将`pmbus_cmd_list.sh`拷贝到正确的位置,无需手动拷贝
|
|
||||||
|
|
||||||
**命令格式**
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
./nicsensor.sh <pcie slot> pmbus <chip slave> <pmbus cmd>
|
|
||||||
```
|
|
||||||
|
|
||||||
**参数说明**
|
|
||||||
- `pcie slot`: 网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型
|
|
||||||
- `chip slave`: 芯片的slave地址
|
|
||||||
- `pmbus cmd`: 要读取的pmbus命令码, 支持列表请使用命令 `./nicsensor.sh help` 查询
|
|
||||||
|
|
||||||
**命令示例**
|
|
||||||
``` shell
|
|
||||||
./nicsensor.sh pcie1 pmbus 0x60 READ_TEMPERATURE_1
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 2_9_压力测试stress
|
|
||||||
|
|
||||||
> [!Warning]
|
|
||||||
>
|
|
||||||
> 支持的脚本版本:v1.10及以上
|
|
||||||
>
|
|
||||||
> ~~压力测试属于额外的功能,需要将 [stress_test.sh](./stress_test.sh) 拷贝到和nicsensor脚本相同的目录。~~
|
|
||||||
>
|
|
||||||
> ~~如果不添加该脚本,该功能无法正常使用~~
|
|
||||||
>
|
|
||||||
> v1.11版本执行setup.sh会自动将`stress_test.sh`拷贝到正确的位置,无需手动拷贝
|
|
||||||
|
|
||||||
**功能介绍**
|
|
||||||
|
|
||||||
一个模块化的压力测试工具,通过配置文件管理测试参数,支持灵活设置测试轮次、间隔、传感器类型等,方便用户进行nicsensor的稳定性测试。
|
|
||||||
|
|
||||||
**命令格式**
|
|
||||||
|
|
||||||
``````sh
|
|
||||||
./nicsensor.sh <pcie slot> stress <option> <option data>
|
|
||||||
``````
|
|
||||||
|
|
||||||
**参数说明**
|
|
||||||
|
|
||||||
| 参数名称 | 数据类型 | 说明 |
|
|
||||||
| ------------- | -------- | ------------------------------------------------------------ |
|
|
||||||
| `pcie slot` | string | nicsensor工具通用格式,在这里无特殊含义 |
|
|
||||||
| `option` | string | 要执行的stress命令类型,有如下取值<br>`start` : 开始执行压力测试,无需option data<br>`show`: 显示压力测试的配置项, 无需option data<br>`round`: 要执行的压力测试圈数<br>`tool`: 要使用的nicsensor脚本,默认为nicsensor.sh<br>`interval`: 每一圈执行的时间间隔,单位为秒(s)<br>`slot`: 目标测试的插槽号<br>`sensor`: 需要测试的传感器类型<br>`slave`: 目标传感器的slave地址 |
|
|
||||||
| `option data` | string | 依据option类型决定是否需要该字段 |
|
|
||||||
|
|
||||||
**命令示例**
|
|
||||||
|
|
||||||
``````sh
|
|
||||||
#场景说明:对pcie1的网卡压测 ina3221(0x42) 100次, 读取间隔2s
|
|
||||||
# step 1 配置测试项
|
|
||||||
./nicsensor.sh pcie1 stress round 100
|
|
||||||
./nicsensor.sh pcie1 stress interval 2
|
|
||||||
./nicsensor.sh pcie1 stress slot pcie1
|
|
||||||
./nicsensor.sh pcie1 stress sensor ina3221
|
|
||||||
./nicsensor.sh pcie1 stress slave 0x42
|
|
||||||
# step 2 查看测试项是否符合预期
|
|
||||||
./nicsensor.sh pcie1 stress show
|
|
||||||
# step 3 开始测试
|
|
||||||
./nicsensor.sh pcie1 stress start
|
|
||||||
``````
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 3_常见问题FAQ
|
|
||||||
|
|
||||||
|
在 `handle_reserve` 中可以自定义需要对网卡实现的功能。在调用该函数之前脚本会将 PCA9641及PCA9548选通。扩展功能时无需考虑PCA9641和PCA9548的状态。
|
||||||
|
|
||||||
|
## 3_常见问题
|
||||||
|
|
||||||
### 3_1_ADC128传感器读值为0
|
### 3_1_ADC128传感器读值为0
|
||||||
|
|
||||||
ADC128传感器在使用时需要初始化, 因此第一次读取时传感器可能并未完成初始化, 所以读值为0
|
ADC128传感器在使用时需要初始化, 因此第一次读取时传感器可能并未完成初始化, 所以读值为0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 3_2_脚本执行时出现大批量语法错误
|
### 3_2_脚本执行时出现大批量语法错误
|
||||||
|
|
||||||
通常是因为服务器上含有PCA9641切断了BMC的I2C控制权导致, 重试即可
|
通常是因为服务器上含有PCA9641切断了BMC的I2C控制权导致,重试即可
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 3_3_传感器读值不正确
|
|
||||||
|
|
||||||
常见于ina3221传感器读值明显不正确, 因为ina3221的i2c slave地址比较敏感, 容易和pca9641产生冲突, 可首先按照i2c地址冲突的方向去排查问题。
|
|
||||||
|
|
||||||
### 3_4_插件升级
|
|
||||||
|
|
||||||
如果插件功能,例如 pmbus , stress 需要更新功能,通常更新对应 nicsensor/extension 目录下的插件本体即可,无需修改nicsensor脚本本体。通过 `nicsensor.sh help ex` 可以查询当前所有插件脚本的版本信息。
|
|
||||||
|
|
||||||
## 4_附属工具
|
## 4_附属工具
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 4_1_FruParse
|
### 4_1_FruParse
|
||||||
|
|
||||||
提供了一个简单python脚本用于解析FRU的数据, 将nicsensor读取到的FRU数据拷贝到frudata.txt后, 执行
|
提供了一个简单python脚本用于解析FRU的数据, 将nicsensor读取到的FRU数据拷贝到frudata.txt后, 执行
|
||||||
`python fru_parse.py`即可将读取到的数据转化为FRU内容
|
`python fru_parse.py`即可将读取到的数据转化为FRU内容
|
||||||
|
|
||||||
**工具路径**:[fru_parse.py](./tool/fru_parse/fru_parse.py)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 4_2_nicsensor_s
|
|
||||||
|
|
||||||
该工具已于`nicsensor v1.10` 移除
|
|
||||||
|
|
||||||
~~基于脚本版本1.8, 剔除了所有记日志的操作, 用于加速i2c的执行, 确保在9641工作的生命周期内尽快完成i2c任务~~
|
|
||||||
|
|
||||||
~~**工具路径**:[nicsensor_s.sh](./nicsensor_s.sh)~~
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 5_关于nicsensor_v2
|
## 5_关于nicsensor_v2
|
||||||
|
|
||||||
nicsensor_v2将服务器选通channel和读取传感器数值的功能解耦, 因此在单独使用某个功能时可以直接找到对应的脚本进行测试。
|
nicsensor_v2将服务器选通channel和读取传感器数值的功能解耦,因此在单独使用某个功能时可以直接找到对应的脚本进行测试。
|
||||||
详见[nicsensor_v2](./nicsensor_v2/readme.md)
|
详见[nicsensor_v2](./nicsensor_v2/readme.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 6_附录
|
## 6_附录
|
||||||
|
|
||||||
### 6_1_Project变量说明
|
### 6_1_Project变量说明
|
||||||
|
|
||||||
> [!important]
|
|
||||||
> 对于所有传感器的`xxx_Channel_name`, 将其配置为`disable`即可跳过对应的channel的数据解析。
|
|
||||||
> 推荐在硬件上空置的Channel将其配置为 `disable`,防止脚本解析数据时出现混淆
|
|
||||||
|
|
||||||
**ADC128**相关
|
**ADC128**相关
|
||||||
|
- `votage_division_factor_0`: ADC128芯片Channel 0的分压系数
|
||||||
|
- `votage_division_factor_1`: ADC128芯片Channel 1的分压系数
|
||||||
|
- `votage_division_factor_2`: ADC128芯片Channel 2的分压系数
|
||||||
|
- `votage_division_factor_3`: ADC128芯片Channel 3的分压系数
|
||||||
|
- `votage_division_factor_4`: ADC128芯片Channel 4的分压系数
|
||||||
|
- `votage_division_factor_5`: ADC128芯片Channel 5的分压系数
|
||||||
|
- `votage_division_factor_6`: ADC128芯片Channel 6的分压系数
|
||||||
|
- `votage_division_factor_7`: ADC128芯片Channel 7的分压系数
|
||||||
|
|
||||||
| 变量 | 定义 |
|
- `ADC128_Channel0_name`: 定制化ADC128芯片Channel 0的电压名称
|
||||||
| -------------------------- | ----------------------------------- |
|
- `ADC128_Channel1_name`: 定制化ADC128芯片Channel 1的电压名称
|
||||||
| `votage_division_factor_0` | ADC128芯片Channel 0的分压系数 |
|
- `ADC128_Channel2_name`: 定制化ADC128芯片Channel 2的电压名称
|
||||||
| `votage_division_factor_1` | ADC128芯片Channel 1的分压系数 |
|
- `ADC128_Channel3_name`: 定制化ADC128芯片Channel 3的电压名称
|
||||||
| `votage_division_factor_2` | ADC128芯片Channel 2的分压系数 |
|
- `ADC128_Channel4_name`: 定制化ADC128芯片Channel 4的电压名称
|
||||||
| `votage_division_factor_3` | ADC128芯片Channel 3的分压系数 |
|
- `ADC128_Channel5_name`: 定制化ADC128芯片Channel 5的电压名称
|
||||||
| `votage_division_factor_4` | ADC128芯片Channel 4的分压系数 |
|
- `ADC128_Channel6_name`: 定制化ADC128芯片Channel 6的电压名称
|
||||||
| `votage_division_factor_5` | ADC128芯片Channel 5的分压系数 |
|
- `ADC128_Channel7_name`: 定制化ADC128芯片Channel 7的电压名称
|
||||||
| `votage_division_factor_6` | ADC128芯片Channel 6的分压系数 |
|
|
||||||
| `votage_division_factor_7` | ADC128芯片Channel 7的分压系数 |
|
|
||||||
| `ADC128_Channel0_name` | 定制化ADC128芯片Channel 0的电压名称 |
|
|
||||||
| `ADC128_Channel1_name` | 定制化ADC128芯片Channel 1的电压名称 |
|
|
||||||
| `ADC128_Channel2_name` | 定制化ADC128芯片Channel 2的电压名称 |
|
|
||||||
| `ADC128_Channel3_name` | 定制化ADC128芯片Channel 3的电压名称 |
|
|
||||||
| `ADC128_Channel4_name` | 定制化ADC128芯片Channel 4的电压名称 |
|
|
||||||
| `ADC128_Channel5_name` | 定制化ADC128芯片Channel 5的电压名称 |
|
|
||||||
| `ADC128_Channel6_name` | 定制化ADC128芯片Channel 6的电压名称 |
|
|
||||||
| `ADC128_Channel7_name` | 定制化ADC128芯片Channel 7的电压名称 |
|
|
||||||
|
|
||||||
**INA3221**相关
|
**INA3221**相关
|
||||||
|
- `shunt_resistor_0`: INA3221芯片的Channel 0外接的分流电阻的大小(单位:毫欧)
|
||||||
|
- `shunt_resistor_1`: INA3221芯片的Channel 1外接的分流电阻的大小(单位:毫欧)
|
||||||
|
- `shunt_resistor_2`: INA3221芯片的Channel 2外接的分流电阻的大小(单位:毫欧)
|
||||||
|
|
||||||
| 变量 | 定义 |
|
- `INA3221_Channel0_name`: 定制化INA3221芯片Channel 0的名称
|
||||||
| ----------------------- | ----------------------------------------------------- |
|
- `INA3221_Channel1_name`: 定制化INA3221芯片Channel 1的名称
|
||||||
| `shunt_resistor_0` | INA3221芯片的Channel 0外接的分流电阻的大小(单位:毫欧) |
|
- `INA3221_Channel2_name`: 定制化INA3221芯片Channel 2的名称
|
||||||
| `shunt_resistor_1` | INA3221芯片的Channel 1外接的分流电阻的大小(单位:毫欧) |
|
|
||||||
| `shunt_resistor_2` | INA3221芯片的Channel 2外接的分流电阻的大小(单位:毫欧) |
|
|
||||||
| `INA3221_Channel0_name` | 定制化INA3221芯片Channel 0的名称 |
|
|
||||||
| `INA3221_Channel1_name` | 定制化INA3221芯片Channel 1的名称 |
|
|
||||||
| `INA3221_Channel2_name` | 定制化INA3221芯片Channel 2的名称 |
|
|
||||||
|
|
||||||
**EMC1413**相关
|
**EMC1413**相关
|
||||||
|
- `EMC1413_Channel0_name`: 定制化EMC1413芯片Channel 0的温度名称
|
||||||
| 变量 | 定义 |
|
- `EMC1413_Channel1_name`: 定制化EMC1413芯片Channel 1的温度名称
|
||||||
| ----------------------- | ------------------------------------ |
|
- `EMC1413_Channel2_name`: 定制化EMC1413芯片Channel 2的温度名称
|
||||||
| `EMC1413_Channel0_name` | 定制化EMC1413芯片Channel 0的温度名称 |
|
|
||||||
| `EMC1413_Channel1_name` | 定制化EMC1413芯片Channel 1的温度名称 |
|
|
||||||
| `EMC1413_Channel2_name` | 定制化EMC1413芯片Channel 2的温度名称 |
|
|
||||||
|
|
||||||
**TMP468**相关
|
**TMP468**相关
|
||||||
|
- `TMP468_Channel0_name`: 定制化TMP468芯片Loacl Channel的温度名称
|
||||||
| 变量 | 定义 |
|
- `TMP468_Channel1_name`: 定制化TMP468芯片Remote1 Channel的温度名称
|
||||||
| ---------------------- | ----------------------------------------- |
|
- `TMP468_Channel2_name`: 定制化TMP468芯片Remote2 Channel的温度名称
|
||||||
| `TMP468_Channel0_name` | 定制化TMP468芯片Loacl Channel的温度名称 |
|
- `TMP468_Channel3_name`: 定制化TMP468芯片Remote3 Channel的温度名称
|
||||||
| `TMP468_Channel1_name` | 定制化TMP468芯片Remote1 Channel的温度名称 |
|
- `TMP468_Channel4_name`: 定制化TMP468芯片Remote4 Channel的温度名称
|
||||||
| `TMP468_Channel2_name` | 定制化TMP468芯片Remote2 Channel的温度名称 |
|
- `TMP468_Channel5_name`: 定制化TMP468芯片Remote5 Channel的温度名称
|
||||||
| `TMP468_Channel3_name` | 定制化TMP468芯片Remote3 Channel的温度名称 |
|
- `TMP468_Channel6_name`: 定制化TMP468芯片Remote6 Channel的温度名称
|
||||||
| `TMP468_Channel4_name` | 定制化TMP468芯片Remote4 Channel的温度名称 |
|
- `TMP468_Channel7_name`: 定制化TMP468芯片Remote7 Channel的温度名称
|
||||||
| `TMP468_Channel5_name` | 定制化TMP468芯片Remote5 Channel的温度名称 |
|
- `TMP468_Channel8_name`: 定制化TMP468芯片Remote8 Channel的温度名称
|
||||||
| `TMP468_Channel6_name` | 定制化TMP468芯片Remote6 Channel的温度名称 |
|
|
||||||
| `TMP468_Channel7_name` | 定制化TMP468芯片Remote7 Channel的温度名称 |
|
|
||||||
| `TMP468_Channel8_name` | 定制化TMP468芯片Remote8 Channel的温度名称 |
|
|
||||||
|
|
||||||
**TMP112**相关
|
**TMP112**相关
|
||||||
|
- `TMP112_Sensor_name`: 定制化TMP112对应的名称
|
||||||
|
|
||||||
| 变量 | 定义 |
|
**FRU**相关
|
||||||
| -------------------- | ---------------------- |
|
- `fru_offset`: 网卡FRU所在eeprom的偏移量。默认值为 0x00 0x00
|
||||||
| `TMP112_Sensor_name` | 定制化TMP112对应的名称 |
|
|
||||||
|
|
||||||
**INA226**相关
|
|
||||||
|
|
||||||
| 变量 | 定义 |
|
|
||||||
| ---------------------- | ------------------------------- |
|
|
||||||
| `INA226_Channel0_name` | 定制化INA226芯片Channel 0的名称 |
|
|
||||||
|
|
||||||
**LM95241**相关
|
|
||||||
|
|
||||||
| 变量 | 定义 |
|
|
||||||
| ---------------------- | ------------------------------------------ |
|
|
||||||
| `LM95241_Local_name` | 定制化LM95241芯片Loacl Channel的温度名称 |
|
|
||||||
| `LM95241_Remote1_name` | 定制化LM95241芯片Remote1 Channel的温度名称 |
|
|
||||||
| `LM95241_Remote2_name` | 定制化LM95241芯片Remote2 Channel的温度名称 |
|
|
||||||
|
|
||||||
|
**所用服务器**
|
||||||
|
- `server_type`: 脚本将工作在哪个服务器上?支持的服务器列表见`Support_Server_List`
|
||||||
57
setup.sh
57
setup.sh
@ -1,57 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Script Description:
|
|
||||||
# This script is used to auto setup the nicsensor tool and its extensions.
|
|
||||||
|
|
||||||
SCRIPT_VERSION="1.0.0"
|
|
||||||
SUPPORT_TOOL_VERSION="1.11"
|
|
||||||
|
|
||||||
# Default values
|
|
||||||
source_extension_dir="./extension"
|
|
||||||
destination_tool_dir="/extlog/nicsensor"
|
|
||||||
destination_extension_dir="/extlog/nicsensor/extension"
|
|
||||||
exec_path="/extlog/nicsensor/nicsensor.sh"
|
|
||||||
|
|
||||||
# PRINT SCRIPT INFO
|
|
||||||
echo "=== Nicsensor Quick Setup Script! ==="
|
|
||||||
echo "Setup Tool Version : $SCRIPT_VERSION"
|
|
||||||
echo "Support nicsensor tool Version : $SUPPORT_TOOL_VERSION"
|
|
||||||
|
|
||||||
# Check if the destination extension directory exists, if not, create it
|
|
||||||
if [ ! -d "$destination_extension_dir" ]; then
|
|
||||||
echo "Step 0 : Create directory $destination_extension_dir"
|
|
||||||
mkdir -p "$destination_extension_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get script Path
|
|
||||||
script_dir=$(pwd)
|
|
||||||
source_extension_dir="$script_dir/extension"
|
|
||||||
|
|
||||||
# check if the source extension directory exists, if not, exit
|
|
||||||
if [ ! -d "$source_extension_dir" ]; then
|
|
||||||
echo "Error : Source extension directory $source_extension_dir does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# copy the extension files to the destination directory
|
|
||||||
echo "Step 1 : Copy extension files to $destination_extension_dir"
|
|
||||||
cp -rf "$source_extension_dir"/* "$destination_extension_dir"
|
|
||||||
|
|
||||||
# Add execute permission for extension files
|
|
||||||
echo "Step 2 : Add execute permission for extension files"
|
|
||||||
chmod +x "$destination_extension_dir"/*
|
|
||||||
|
|
||||||
# copy the project config to the destination directory
|
|
||||||
echo "Step 3 : Copy project.config to $destination_tool_dir"
|
|
||||||
cp -f "./project.config" "$destination_tool_dir"
|
|
||||||
|
|
||||||
# copy the exec file to the destination directory
|
|
||||||
echo "Step 4 : Copy nicsensor to $exec_path"
|
|
||||||
cp -f "./nicsensor.sh" "$exec_path"
|
|
||||||
|
|
||||||
# Add execute permission for exec file
|
|
||||||
echo "Step 5 : Add execute permission for nicsensor"
|
|
||||||
chmod +x "$exec_path"
|
|
||||||
|
|
||||||
|
|
||||||
echo "Complete auto setup nicsensor tool and its extensions."
|
|
||||||
@ -1,122 +0,0 @@
|
|||||||
import os
|
|
||||||
import zipfile
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# ===================== 【可配置项】 =====================
|
|
||||||
# 输出目录(可自定义修改,例如 D:/release / /home/user/release)
|
|
||||||
OUTPUT_DIR = ""
|
|
||||||
|
|
||||||
# 最小打包内容
|
|
||||||
MIN_FILES = [
|
|
||||||
"extension",
|
|
||||||
"nicsensor.sh",
|
|
||||||
"project.config",
|
|
||||||
"setup.sh"
|
|
||||||
]
|
|
||||||
|
|
||||||
# 完整工程打包内容(所有文件)
|
|
||||||
FULL_FILES = [
|
|
||||||
"docs",
|
|
||||||
"extension",
|
|
||||||
"tool",
|
|
||||||
"nicsensor.sh",
|
|
||||||
"project.config",
|
|
||||||
"readme.md",
|
|
||||||
"setup.sh"
|
|
||||||
]
|
|
||||||
# ======================================================
|
|
||||||
|
|
||||||
|
|
||||||
def get_project_root():
|
|
||||||
"""
|
|
||||||
自动获取工程根目录(脚本在 tool/auto_package/ 下)
|
|
||||||
"""
|
|
||||||
# 当前脚本目录:tool/auto_package
|
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
# 工程根目录 = 往上两级
|
|
||||||
project_root = os.path.abspath(os.path.join(current_dir, "../.."))
|
|
||||||
return project_root
|
|
||||||
|
|
||||||
|
|
||||||
def pack_files(zip_path, file_list, project_root):
|
|
||||||
"""
|
|
||||||
统一打包函数
|
|
||||||
"""
|
|
||||||
os.chdir(project_root) # 切换到工程根目录,保证打包路径正确
|
|
||||||
|
|
||||||
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zipf:
|
|
||||||
for item in file_list:
|
|
||||||
if not os.path.exists(item):
|
|
||||||
print(f"⚠️ 跳过不存在:{item}")
|
|
||||||
continue
|
|
||||||
|
|
||||||
# 递归打包文件夹
|
|
||||||
if os.path.isdir(item):
|
|
||||||
for root, dirs, files_in_dir in os.walk(item):
|
|
||||||
for f in files_in_dir:
|
|
||||||
file_path = os.path.join(root, f)
|
|
||||||
arc_path = os.path.relpath(file_path, project_root)
|
|
||||||
zipf.write(file_path, arc_path)
|
|
||||||
print(f" ✔ {arc_path}")
|
|
||||||
else:
|
|
||||||
zipf.write(item, item)
|
|
||||||
print(f" ✔ {item}")
|
|
||||||
|
|
||||||
|
|
||||||
def build_all(version):
|
|
||||||
"""
|
|
||||||
一次性构建 min + full 两个包
|
|
||||||
"""
|
|
||||||
project_root = get_project_root()
|
|
||||||
OUTPUT_DIR = os.path.join(project_root, "Release")
|
|
||||||
output_abs = os.path.abspath(OUTPUT_DIR)
|
|
||||||
|
|
||||||
# 创建输出目录
|
|
||||||
if not os.path.exists(output_abs):
|
|
||||||
os.makedirs(output_abs)
|
|
||||||
|
|
||||||
# 文件名
|
|
||||||
zip_min = os.path.join(output_abs, f"nicsensor-{version}-min.zip")
|
|
||||||
zip_full = os.path.join(output_abs, f"nicsensor-{version}-full.zip")
|
|
||||||
|
|
||||||
print("=" * 60)
|
|
||||||
print(" 开始自动打包")
|
|
||||||
print(f"版本号:{version}")
|
|
||||||
print(f"工程根目录:{project_root}")
|
|
||||||
print(f"输出目录:{output_abs}")
|
|
||||||
print("=" * 60)
|
|
||||||
|
|
||||||
# 打包最小版
|
|
||||||
print("\n📦 开始打包【最小版本】")
|
|
||||||
pack_files(zip_min, MIN_FILES, project_root)
|
|
||||||
|
|
||||||
# 打包完整版
|
|
||||||
print("\n📦 开始打包【完整工程】")
|
|
||||||
pack_files(zip_full, FULL_FILES, project_root)
|
|
||||||
|
|
||||||
print("\n✅ 全部打包完成!")
|
|
||||||
print(f"📍 最小包:{zip_min}")
|
|
||||||
print(f"📍 完整包:{zip_full}")
|
|
||||||
print("=" * 60)
|
|
||||||
|
|
||||||
|
|
||||||
def show_usage():
|
|
||||||
print("=" * 50)
|
|
||||||
print(" Nicsensor 一键打包脚本")
|
|
||||||
print("=" * 50)
|
|
||||||
print("使用方法:")
|
|
||||||
print(" python pack.py 版本号")
|
|
||||||
print()
|
|
||||||
print("示例:")
|
|
||||||
print(" python pack.py v1.0.0")
|
|
||||||
print(" python pack.py 2.5.0")
|
|
||||||
print("=" * 50)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
show_usage()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
version = sys.argv[1]
|
|
||||||
build_all(version)
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# 20250627
|
|
||||||
# A tool script to test a value greater or less than threhold
|
|
||||||
|
|
||||||
data=$1
|
|
||||||
direction=$2
|
|
||||||
threhold=$3
|
|
||||||
param_num=$#
|
|
||||||
|
|
||||||
print_usage(){
|
|
||||||
echo " Script Usage"
|
|
||||||
echo " ./check_threhold.sh <value> <direction> <threhold>"
|
|
||||||
echo " @Param direction : greater , >"
|
|
||||||
echo " less , <"
|
|
||||||
echo " equal , ="
|
|
||||||
echo ""
|
|
||||||
echo " E.G. ./check_threhold.sh 500 > 1000"
|
|
||||||
echo " +--> Result : 0"
|
|
||||||
echo ""
|
|
||||||
echo " About Result: 1 means true, 0 means fault"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
main(){
|
|
||||||
if [ ${param_num} -ne 3 ];then
|
|
||||||
print_usage
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${direction}" = "great" ] || [ "${direction}" = ">" ];then
|
|
||||||
res= `echo " $data > $threhold" | bc -l`
|
|
||||||
elif [ "${direction}" = "less" ] || [ "${direction}" = "<" ];then
|
|
||||||
res= `echo " $data < $threhold" | bc -l`
|
|
||||||
elif [ "${direction}" = "equal" ] || [ "${direction}" = "=" ];then
|
|
||||||
res= `echo " $data = $threhold" | bc -l`
|
|
||||||
else
|
|
||||||
echo "Invalid direction"
|
|
||||||
print_usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $res
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
# 测试治具说明
|
|
||||||
|
|
||||||
> [!info]
|
|
||||||
> nicsensor提供了一部分测试治具脚本用于辅助编写测试脚本
|
|
||||||
|
|
||||||
## 阈值校验脚本-check_threhold.sh
|
|
||||||
|
|
||||||
阈值校验脚本提供了判断数值是否大于目标阈值的方法, 可进行整数和小数的比较。使用方法如下:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# 测试数据大于阈值
|
|
||||||
# 例如测试数据是否大于100,有如下使用方法
|
|
||||||
res=`./check_threhold.sh ${data} > 100`
|
|
||||||
if [ $res -eq 1 ];then
|
|
||||||
echo "data is greater than threholds"
|
|
||||||
else
|
|
||||||
echo "data isn't greater than threholds"
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
Loading…
Reference in New Issue
Block a user