Question:
Troubleshooting a port that does not come up on Advantech CPE
Solution:
Follow these steps to configure and enable a port on an Advantech CPE:
1. Run the %sudo dmidecode -t command to check the manufacturing information.
Example:
%sudo dmidecode -t
Output:
Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: Versa Networks, Inc. Product Name: FWA13201602E-T Version: Serial Number: KSA2074846 UUID: 03000200-0400-0500-0006-000700080009 Wake-up Type: Power Switch SKU Number: Versa 110 Family: Server
NOTE: Versa currently does not support "FWA13201602E-T" as Product Name.
2. Run this script on the Advantech box to fix the issue.
#!/bin/bash
#
# Utility script to fix Advantech FWA13201602E-T
# model so that it is detected as a branch device.
# Reorders NICs and set serial number
#
# Author: mmehra@versa-networks.com
# Date : Mon Feb 27 15:59:18 PST 2017
#
# (c) Versa Networks Inc
#
readonly RULE_FILE=/etc/udev/rules.d/70-persistent-net.rules
readonly BRANCH_DB=/opt/versa/scripts/device-models.info
readonly NEW_MODEL="FWA13201602E-T"
get_dmidecode_info()
{
local TYPE=$1
local PATTERN="$2"
local VAR=$(dmidecode -t "$TYPE" | grep -m1 "$PATTERN" | cut -d: -f2)
VAR=$(echo "$VAR" | xargs)
echo "$VAR"
}
replace_udev_rules ()
{
echo " => Reordering interfaces"
if [[ -f $RULE_FILE ]]; then
truncate -s 0 "$RULE_FILE"
fi
cat << EOF >> $RULE_FILE
KERNELS=="0000:02:00.0", SUBSYSTEMS=="pci", KERNEL=="eth*", NAME="eth0"
KERNELS=="0000:03:00.0", SUBSYSTEMS=="pci", KERNEL=="eth*", NAME="eth1"
KERNELS=="0000:00:14.0", SUBSYSTEMS=="pci", KERNEL=="eth*", NAME="eth2"
KERNELS=="0000:00:14.1", SUBSYSTEMS=="pci", KERNEL=="eth*", NAME="eth3"
KERNELS=="0000:00:14.2", SUBSYSTEMS=="pci", KERNEL=="eth*", NAME="eth4"
KERNELS=="0000:00:14.3", SUBSYSTEMS=="pci", KERNEL=="eth*", NAME="eth5"
EOF
}
set_serial()
{
local SERIAL_FILE=/var/lib/vs/.serial
local SERIAL=$(get_dmidecode_info 1 "Serial")
echo "=> Setting up Advantech $MODEL"
echo "$MODEL" > "$BRANCH_MODEL_FILE"
echo -n "$SERIAL" > "$SERIAL_FILE"
chmod g+r "$SERIAL_FILE"
if grep -q "$NEW_MODEL" "$BRANCH_DB"; then
echo " => Updating branch database"
echo "device 'Advantech' '$NEW_MODEL' 'N' 'Y'" >> "$BRANCH_DB"
fi
}
main()
{
MODEL=$(get_dmidecode_info 1 "Product Name")
if [[ $MODEL != $NEW_MODEL ]]; then
echo " => Unknown model number: $MODEL"
echo " => Please contact Versa Support"
exit 1
fi
set_serial
replace_udev_rules
echo " => Reboot is needed for changes to take effect."
echo " => Rebooting in 5 seconds"
sleep 5
shutdown -r now
}
if [[ $EUID != 0 ]]; then
echo "Please execute with sudo"
exit 1
fi
main