netdev test working
This commit is contained in:
parent
f1192659f0
commit
c8f56a43f1
2 changed files with 54 additions and 1 deletions
|
@ -6,9 +6,10 @@ fi
|
||||||
|
|
||||||
echo "#DEV MA:CA:DD:RE:SS" > $OUTPUT_DIR/netdev.lst
|
echo "#DEV MA:CA:DD:RE:SS" > $OUTPUT_DIR/netdev.lst
|
||||||
for DEV in \
|
for DEV in \
|
||||||
`cat /proc/net/dev | grep ':' | cut -d ':' -f 1`
|
`cat /proc/net/dev | grep ':' | cut -d ':' -f 1`
|
||||||
do
|
do
|
||||||
MAC=`ethtool -P $DEV | cut -d ':' -f 2-9 | sed 's/\s\+//g'`
|
MAC=`ethtool -P $DEV | cut -d ':' -f 2-9 | sed 's/\s\+//g'`
|
||||||
|
#MAC=`cat /sys/class/net/$DEV/address`
|
||||||
if [[ "$MAC" != "00:00:00:00:00:00" ]] ; then
|
if [[ "$MAC" != "00:00:00:00:00:00" ]] ; then
|
||||||
#echo "$DEV $MAC"
|
#echo "$DEV $MAC"
|
||||||
echo "$DEV $MAC" >> $OUTPUT_DIR/netdev.lst
|
echo "$DEV $MAC" >> $OUTPUT_DIR/netdev.lst
|
||||||
|
|
|
@ -1,3 +1,55 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
source scan-netdev
|
||||||
|
source test-variables
|
||||||
|
|
||||||
|
check_listed_mac () {
|
||||||
|
if [[ -n $LISTED_MAC ]] ; then
|
||||||
|
echo "$RES_ERROR: $BLD$MAC$OFF belongs to $LISTED_DEV"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
while [[ 1 ]] ; do
|
||||||
|
clear
|
||||||
|
date
|
||||||
|
for DEV in \
|
||||||
|
`cat /proc/net/dev \
|
||||||
|
| grep -v 'lo:' \
|
||||||
|
| grep ':' \
|
||||||
|
| cut -d ':' -f 1`
|
||||||
|
do
|
||||||
|
MAC=`cat /sys/class/net/$DEV/address`
|
||||||
|
LISTED=`cat $OUTPUT_DIR/netdev.lst | grep $DEV`
|
||||||
|
MATCHING_MAC=`echo $LISTED | grep $MAC`
|
||||||
|
LISTED_MAC=`cat $OUTPUT_DIR/netdev.lst | grep $MAC`
|
||||||
|
LISTED_DEV=`echo $LISTED_MAC | cut -d ' ' -f 1`
|
||||||
|
LINKING=`cat /sys/class/net/$DEV/operstate`
|
||||||
|
if [[ "$LINKING" == "up" ]] ; then
|
||||||
|
echo -n "$GRN$DEV$OFF "
|
||||||
|
else
|
||||||
|
echo -n "$RED$DEV$OFF "
|
||||||
|
fi
|
||||||
|
if [[ -z $LISTED ]] ; then
|
||||||
|
echo "$MAC $RES_ERROR: Device $BLD$DEV$OFF not listed"
|
||||||
|
check_listed_mac
|
||||||
|
elif [[ -z $MATCHING_MAC ]] ; then
|
||||||
|
echo -n "$RES_ERROR: Mac addres $BLD$MAC$OFF "
|
||||||
|
echo "not matching for $BLD$DEV$OFF"
|
||||||
|
check_listed_mac
|
||||||
|
else
|
||||||
|
echo "$MAC $LINKING"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for DEV in \
|
||||||
|
`cat $OUTPUT_DIR/netdev.lst | sed 's/#.*$//' | cut -d ' ' -f 1`
|
||||||
|
do
|
||||||
|
STILL_THERE=`cat /proc/net/dev | grep $DEV`
|
||||||
|
if [[ -z $STILL_THERE ]] ; then
|
||||||
|
echo "$BLD$DEV$OFF $RES_ERROR: Device missing"
|
||||||
|
check_listed_mac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue