-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPRBS_API.sh
85 lines (77 loc) · 2.17 KB
/
PRBS_API.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
enable
term shell
configure terminal | null
shell processing full
service internal
no logging console
line con 0
exec-timeout 0 0
exit
line vty 0 4
exec-timeout 0 0
end
ti=`show clock | cut -d ' ' -f 1 | cut -d '*' -f 2`
totalerr=0
copperports=48
function SetPortEnabledState() {
interface=$1
if [[ 'disable' == $2 ]]; then
state='shut'
else;
state='no shut'
fi
conf t | null
int Te1/1/$interface
$state
if (( $3 )); then
speed $3
fi
end
}
function SetVoltageMargin() {
voltmarg=$2
conf t | null
Voltage all $voltmarg switch 1
end
}
function SetPRBSPattern() {
interface=$1
pattern=$2
let port = $copperports + $interface
templock='null'
for x in `sh int | nl | cut -d":" -f 1 | head 5`; do
if [[ 'Aquired' != $templock ]]; then
Test platform hardware fed switch 1 port $port phy prbs start prbs-$pattern | null
templock=`Test platform hardware fed switch 1 port $port phy prbs show-lock-stats | grep lock | cut -d ' ' -f 7`
fi
done
}
function StartPRBSStatistics() {
totalerr=0
ti=`show clock | cut -d ' ' -f 1 | cut -d '*' -f 2`
echo ''
}
function GetPRBSStatistics() {
interface=$1
let port = $copperports + $interface
errhex=`Test platform hardware fed switch 1 port $port phy prbs show-lock-stats | grep Error | cut -d 'x' -f 2`
tf=`show clock | cut -d ' ' -f 1 | cut -d '*' -f 2`
lock=`Test platform hardware fed switch 1 port $port phy prbs show-lock-stats | grep lock | cut -d ' ' -f 7`
errdec=`printf '%d' 0x$errhex`
let totalerr += $errdec
if [[ 'Aquired' == $lock ]]; then
lockstat='Locked'
else;
lockstat='Unlocked'
fi
echo $totalerr, dec, $ti, $tf, $lockstat
echo ''
}
function GetDomPower() {
interface=$1
let port = $copperports + $interface
dompower=`sh int te1/1/$interface tra de | tail 2 | head 1 | cut -d ' ' -f 7,8,9`
echo $dompower
echo ''
}
#END OF FUNCTIONS