Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Starting Kit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Starting Kit
Commits
57bb56c8
Commit
57bb56c8
authored
Oct 08, 2019
by
Manuel Castilla
Committed by
Benoit Rat
Oct 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merged in manu-190717_update_tests (pull request #7)
Manu 190717 update tests
parents
7f3e4ae3
dd64e981
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
57 deletions
+71
-57
dio.py
test/validation/dio.py
+4
-4
loadDriver.py
test/validation/loadDriver.py
+4
-10
testAdvDIO.py
test/validation/testAdvDIO.py
+15
-9
testDIO.py
test/validation/testDIO.py
+23
-20
testNIC.py
test/validation/testNIC.py
+14
-10
testWR.py
test/validation/testWR.py
+2
-2
vuart.py
test/validation/vuart.py
+9
-2
No files found.
test/validation/dio.py
View file @
57bb56c8
...
...
@@ -12,7 +12,7 @@ from ssh import SshCmd,SshCmdException
## Class DIO
#
class
DIO
():
def
__init__
(
self
,
hostName
,
userName
,
password
,
interfaceName
):
def
__init__
(
self
,
hostName
,
userName
,
password
,
busId
):
"""
Construcctor
...
...
@@ -20,13 +20,13 @@ class DIO ():
hostName: ip or hostname
userName: username
password : password
interfaceName: interface name
busId: number PCIe bus
"""
self
.
hostName
=
hostName
self
.
userName
=
userName
self
.
password
=
password
self
.
interfaceName
=
interfaceName
self
.
command
=
"sudo wr-dio-cmd
"
+
interfaceName
self
.
busId
=
busId
self
.
command
=
"sudo wr-dio-cmd
/dev/fmc-dio-
%
i:0"
%
int
(
busId
,
16
)
self
.
sshCmd
=
SshCmd
()
def
configurePort
(
self
,
channel
,
mode
):
...
...
test/validation/loadDriver.py
View file @
57bb56c8
...
...
@@ -31,16 +31,10 @@ def loadDriver(hostName,userName,password):
command
=
"ifconfig | grep wr | wc -l"
value
=
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
if
(
int
(
value
)
==
0
):
command
=
"sudo modprobe -r spec"
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
command
=
"sudo modprobe -r wr-nic"
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
command
=
"sudo modprobe spec"
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
command
=
"sudo insmod /lib/modules/$(uname -r)/extra/wr-nic.ko wrc=1"
#esto es temporal
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
command
=
"sudo modprobe wr-nic"
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
commands
=
[
"sudo modprobe spec"
,
"sudo modprobe htvic"
,
"sudo modprobe wr-nic"
,
"sudo modprobe wr-dio"
]
for
cmd
in
commands
:
sshCmd
.
exec
(
hostName
,
cmd
,
userName
,
password
)
command
=
"ifconfig | grep wr | wc -l"
value
=
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
if
(
int
(
value
)
==
0
):
...
...
test/validation/testAdvDIO.py
View file @
57bb56c8
...
...
@@ -38,7 +38,7 @@ def findTimestamp(listStamp1,listStamp2,offset):
return
False
def
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName
2
):
def
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
busId1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
busId
2
):
"""
Check the pulses generated on a remote board
...
...
@@ -47,33 +47,34 @@ def testAdvDIO(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
username1: user name host 1
password1: password
interfaceName1 : interface name
busId1: number PCIe bus PC 1
hostName2: ip remote host 2
username2: user name host 2
password2: password
interfaceName2 : interface name
busId2: number PCIe bus PC 2
Raises:
error test
"""
try
:
sshCmd1
=
SshCmd
()
sshCmd2
=
SshCmd
()
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
interfaceName
1
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
interfaceName
2
)
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
busId
1
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
busId
2
)
dio1
.
configurePorts
(
"pdiii"
)
dio2
.
configurePorts
(
"iiiii"
)
dio1
.
clearTimestamps
()
dio2
.
clearTimestamps
()
command
=
"sudo wr-dio-agent
"
+
interfaceName1
command
=
"sudo wr-dio-agent
%
s /dev/fmc-dio-
%
i:0"
%
(
interfaceName1
,
int
(
busId1
,
16
))
sshCmd1
.
exec
(
hostName1
,
command
,
userName1
,
password1
,
False
)
command
=
"sudo wr-dio-ruler
"
+
interfaceName1
+
" IN0 R1+"
+
str
(
delay
)
command
=
"sudo wr-dio-ruler
%
s /dev/fmc-dio-
%
i:0 IN0 R1+
%
s"
%
(
interfaceName2
,
int
(
busId1
,
16
),
str
(
delay
)
)
sshCmd2
.
exec
(
hostName2
,
command
,
userName2
,
password2
,
False
)
totalOffset
=
delay
+
maxOffset
time
.
sleep
(
2
)
if
(
not
findTimestamp
(
dio1
.
getTimestamp
(
0
),
dio1
.
getTimestamp
(
1
),
totalOffset
)):
raise
except
SshCmdException
as
e
:
sshCmd
.
printSshErrorCommand
(
e
.
strError
,
command
)
print
(
"Test advanced error"
)
SshCmd
.
printSshErrorCommand
(
e
.
strError
,
command
)
raise
except
:
print
(
"Test advanced error"
)
...
...
@@ -91,14 +92,17 @@ def main(configuration):
userName1
=
configuration
[
"userName1"
]
password1
=
configuration
[
"password1"
]
interfaceName1
=
configuration
[
"interfaceName1"
]
busIdSpec1
=
configuration
[
"busIdSpec1"
]
hostName2
=
configuration
[
"hostName2"
]
userName2
=
configuration
[
"userName2"
]
password2
=
configuration
[
"password2"
]
interfaceName2
=
configuration
[
"interfaceName2"
]
busIdSpec2
=
configuration
[
"busIdSpec2"
]
try
:
print
(
"Executing advanced DIO test"
)
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
)
print
(
"
\n
Executing advanced DIO test"
)
print
(
"This test needs White Rabbit working"
)
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
busIdSpec1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
busIdSpec2
)
print
(
"Test advanced DIO: successful"
)
except
:
print
(
"Test advanced DIO: error"
)
...
...
@@ -115,10 +119,12 @@ if __name__ == '__main__':
configuration
[
"userName1"
]
=
config
.
get
(
'pc1'
,
"userName"
)
configuration
[
"password1"
]
=
config
.
get
(
'pc1'
,
"password"
)
configuration
[
"interfaceName1"
]
=
config
.
get
(
'pc1'
,
"interfaceName"
)
configuration
[
"busIdSpec1"
]
=
config
.
get
(
'pc1'
,
"busIdSpec"
)
configuration
[
"hostName2"
]
=
config
.
get
(
'pc2'
,
"hostName"
)
configuration
[
"userName2"
]
=
config
.
get
(
'pc2'
,
"userName"
)
configuration
[
"password2"
]
=
config
.
get
(
'pc2'
,
"password"
)
configuration
[
"interfaceName2"
]
=
config
.
get
(
'pc2'
,
"interfaceName"
)
configuration
[
"busIdSpec2"
]
=
config
.
get
(
'pc2'
,
"busIdSpec"
)
main
(
configuration
)
except
configparser
.
Error
as
e
:
...
...
test/validation/testDIO.py
View file @
57bb56c8
...
...
@@ -35,7 +35,7 @@ def findTimestamp(listStamp1,listStamp2,offset):
return
False
def
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName
2
,
channel
):
def
tryChannel
(
hostName1
,
userName1
,
password1
,
busId1
,
hostName2
,
userName2
,
password2
,
busId
2
,
channel
):
"""
Try the input and output of channel
...
...
@@ -43,18 +43,18 @@ def tryChannel(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
hostName1: ip remote host 1
username1: user name host 1
password1: password
interfaceName1 : interface name
busId1: number PCIe bus PC 1
hostName2: ip remote host 2
username2: user name host 2
password2: password
interfaceName2 : interface name
busId2: number PCIe bus PC 2
channel: number of channel to try(0 to 4)
R
aises
:
error channel
R
eturn
:
True if the channel fail, False otherwise
"""
try
:
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
interfaceName
1
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
interfaceName
2
)
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
busId
1
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
busId
2
)
dio1
.
configurePorts
(
"pdddd"
)
dio2
.
configurePorts
(
"iiiii"
)
dio1
.
clearTimestamps
()
...
...
@@ -78,13 +78,14 @@ def tryChannel(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
if
(
findTimestamp
(
dio1
.
getTimestamp
(
channel
),
dio2
.
getTimestamp
(
channel
),
maxOffset
)):
print
(
"Channel"
,
channel
,
": ok in host:"
,
hostName1
,
"and host:"
,
hostName2
)
return
False
else
:
raise
else
:
raise
except
:
print
(
"Channel"
,
channel
,
": error in host:"
,
hostName1
,
"or host:"
,
hostName2
)
r
ais
e
r
eturn
Tru
e
#--------------------------------------------------#
...
...
@@ -97,21 +98,23 @@ def main(configuration):
hostName1
=
configuration
[
"hostName1"
]
userName1
=
configuration
[
"userName1"
]
password1
=
configuration
[
"password1"
]
interfaceName1
=
configuration
[
"interfaceName
1"
]
busIdSpec1
=
configuration
[
"busIdSpec
1"
]
hostName2
=
configuration
[
"hostName2"
]
userName2
=
configuration
[
"userName2"
]
password2
=
configuration
[
"password2"
]
interfaceName2
=
configuration
[
"interfaceName
2"
]
busIdSpec2
=
configuration
[
"busIdSpec
2"
]
try
:
print
(
"Executing DIO test"
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
0
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
1
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
2
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
3
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
4
)
error
=
False
numberChannels
=
5
print
(
"
\n
Executing DIO test"
)
print
(
"This test needs White Rabbit working"
)
for
i
in
range
(
numberChannels
):
error
|=
tryChannel
(
hostName1
,
userName1
,
password1
,
busIdSpec1
,
hostName2
,
userName2
,
password2
,
busIdSpec2
,
i
)
if
(
not
error
):
print
(
"Test DIO: successful"
)
e
xcept
:
e
lse
:
print
(
"Test DIO: error"
)
if
__name__
==
'__main__'
:
...
...
@@ -125,11 +128,11 @@ if __name__ == '__main__':
configuration
[
"hostName1"
]
=
config
.
get
(
'pc1'
,
"hostName"
)
configuration
[
"userName1"
]
=
config
.
get
(
'pc1'
,
"userName"
)
configuration
[
"password1"
]
=
config
.
get
(
'pc1'
,
"password"
)
configuration
[
"
interfaceName1"
]
=
config
.
get
(
'pc1'
,
"interfaceName
"
)
configuration
[
"
busIdSpec1"
]
=
config
.
get
(
'pc1'
,
"busIdSpec
"
)
configuration
[
"hostName2"
]
=
config
.
get
(
'pc2'
,
"hostName"
)
configuration
[
"userName2"
]
=
config
.
get
(
'pc2'
,
"userName"
)
configuration
[
"password2"
]
=
config
.
get
(
'pc2'
,
"password"
)
configuration
[
"
interfaceName2"
]
=
config
.
get
(
'pc2'
,
"interfaceName
"
)
configuration
[
"
busIdSpec2"
]
=
config
.
get
(
'pc2'
,
"busIdSpec
"
)
main
(
configuration
)
except
configparser
.
Error
as
e
:
...
...
test/validation/testNIC.py
View file @
57bb56c8
...
...
@@ -28,24 +28,27 @@ def configurationIpInterface(hostName,userName,password,busId,interfaceName,ip):
"""
try
:
sshCmd
=
SshCmd
()
#check network manager
command
=
"sudo service network-manager status | grep running"
value
=
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
if
(
"running"
in
value
):
print
(
"
\n
Warning: The network manager is running on host
%
s, the test may not work correctly
\n
"
%
ip
)
command
=
"sudo ifconfig "
+
interfaceName
+
" "
+
ip
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
command
=
"ifconfig | grep "
+
ip
+
" | wc -l"
value
=
sshCmd
.
exec
(
hostName
,
command
,
userName
,
password
)
if
(
int
(
value
)
==
1
):
vuart
=
Vuart
(
hostName
,
userName
,
password
,
busId
)
value
=
vuart
.
setIp
(
ip
)
if
((
"IP-address: "
+
str
(
ip
))
in
value
):
print
(
"Configuration ip interface: ok in host:"
,
hostName
)
else
:
raise
print
(
"Configuration ip interface: ok on host:"
,
hostName
)
else
:
raise
except
SshCmdException
as
e
:
sshCmd
.
printSshErrorCommand
(
e
.
strError
,
command
)
print
(
"Configuration ip interface: error
i
n host:"
,
hostName
)
print
(
"Configuration ip interface: error
o
n host:"
,
hostName
)
raise
except
:
print
(
"Configuration ip interface
2: error i
n host:"
,
hostName
)
print
(
"Configuration ip interface
: error o
n host:"
,
hostName
)
raise
...
...
@@ -107,7 +110,8 @@ def main(configuration):
interfaceName2
=
configuration
[
"interfaceName2"
]
try
:
print
(
"Executing NIC test"
)
print
(
"
\n
Executing NIC test"
)
print
(
"This test needs the network manager stopped"
)
configurationIpInterface
(
hostName1
,
userName1
,
password1
,
busIdSpec1
,
interfaceName1
,
ipWR1
)
configurationIpInterface
(
hostName2
,
userName2
,
password2
,
busIdSpec2
,
interfaceName2
,
ipWR2
)
testIperf
(
hostName1
,
userName1
,
password1
,
ipWR2
,
hostName2
,
userName2
,
password2
)
...
...
test/validation/testWR.py
View file @
57bb56c8
...
...
@@ -84,7 +84,7 @@ def checkTrackPhase(hostName,userName,password,busId):
"""
try
:
vuart
=
Vuart
(
hostName
,
userName
,
password
,
busId
)
numberTimesTry
=
1
0
numberTimesTry
=
1
5
i
=
0
while
not
vuart
.
isTrackPhase
():
if
(
i
==
numberTimesTry
):
...
...
@@ -114,7 +114,7 @@ def main(configuration):
interfaceName2
=
configuration
[
"interfaceName2"
]
try
:
print
(
"Executing WR test"
)
print
(
"
\n
Executing WR test"
)
masterSpec1
=
whoIsMaster
(
hostName1
,
userName1
,
password1
,
busIdSpec1
)
masterSpec2
=
whoIsMaster
(
hostName2
,
userName2
,
password2
,
busIdSpec2
)
if
(
masterSpec1
==
1
or
masterSpec2
==
1
):
...
...
test/validation/vuart.py
View file @
57bb56c8
...
...
@@ -26,8 +26,15 @@ class Vuart ():
self
.
userName
=
userName
self
.
password
=
password
self
.
busId
=
busId
self
.
command
=
"sudo spec-vuart -b "
+
str
(
busId
)
+
" -c "
self
.
sshCmd
=
SshCmd
()
self
.
command
=
""
parse_dev
=
self
.
vUartCommand
(
"lspci | grep CERN | cut -f2 -d :"
)
.
split
(
"."
)
if
(
len
(
parse_dev
)
>
1
):
self
.
command
=
"sudo wrpc-vuart -f /sys/bus/pci/devices/0000
\
:00
\
:
%02
x.0/0000"
\
"
\
:
%02
x
\
:
%02
x.0/resource0 -o 0x20500 -c "
%
(
int
(
busId
,
16
),
int
(
busId
,
16
),
int
(
parse_dev
[
0
],
16
))
else
:
print
(
"Error: Spec does not detected on host:
%
s"
%
hostName
)
raise
def
setIp
(
self
,
ip
):
"""
...
...
@@ -89,7 +96,7 @@ class Vuart ():
error function
"""
try
:
command
=
"sfp
\
detect
"
command
=
"sfp
\
match
"
return
self
.
vUartCommand
(
command
)
except
:
print
(
"Error sfp detect"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment