Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv RS485 OPT RTM
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
Conv RS485 OPT RTM
Commits
e2b9cd63
Commit
e2b9cd63
authored
Feb 18, 2019
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip cleanup
parent
5179da72
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
129 additions
and
77 deletions
+129
-77
.gitignore
pts/.gitignore
+2
-0
CONFIG.ini
pts/CONFIG.ini
+12
-12
pts.py
pts/python/pts.py
+23
-24
test00.py
pts/python/tests/test00.py
+41
-11
test01.py
pts/python/tests/test01.py
+1
-1
vv_skt.py
pts/python/vv_skt.py
+43
-26
run-pts.sh
pts/run-pts.sh
+7
-3
No files found.
pts/.gitignore
0 → 100644
View file @
e2b9cd63
log/
pts/CONFIG.ini
View file @
e2b9cd63
[GENERAL]
[DUT.FEC]
BoardName
=
"opt-rtm"
MgtHostName
=
cfvm-774-opt-pts2
MgtPort
=
23
[DUT-FEC]
MgtUserName
=
admin
MgtHostName
=
"cfvm-774-opt-pts2"
MgtPassword
=
Gr@nBr@st0
MgtUserName
=
"admin"
MgtPassword
=
"Gr@nBr@st0"
Slot
=
5
Slot
=
5
[CTR-FEC]
[CTR.FEC]
MgtHostName
=
"cfvm-774-opt-pts1"
MgtHostName
=
cfvm-774-opt-pts1
MgtUserName
=
"admin"
MgtPort
=
23
MgtPassword
=
"Gr@nBr@st0"
MgtUserName
=
admin
CpuHostName
=
"cfv-774-opt-pts1"
MgtPassword
=
Gr@nBr@st0
CpuHostName
=
cfv-774-opt-pts1
CpuPort
=
22
pts/python/pts.py
View file @
e2b9cd63
...
@@ -90,18 +90,16 @@ def run_test(testname, logname, card, test_path, serial, yes=False):
...
@@ -90,18 +90,16 @@ def run_test(testname, logname, card, test_path, serial, yes=False):
try
:
try
:
tmpout
=
sys
.
stdout
tmpout
=
sys
.
stdout
sys
.
stdout
=
open
(
logname
,
'w'
)
sys
.
stdout
=
open
(
logname
,
'w'
)
if
yes
:
tmpin
=
sys
.
stdin
tmpin
=
sys
.
stdin
sys
.
stdin
=
open
(
'/dev/null'
)
sys
.
stdin
=
open
(
'/dev/null'
)
__builtins__
.
raw_input
=
pts_raw_input
__builtins__
.
raw_input
=
pts_raw_input
mod
=
__import__
(
testname
,
globals
(),
locals
(),
[])
mod
=
__import__
(
testname
,
globals
(),
locals
(),
[])
card
=
mod
.
main
(
card
,
default_directory
=
test_path
,
serial
=
serial
)
card
=
mod
.
main
(
card
,
default_directory
=
test_path
,
serial
=
serial
)
finally
:
finally
:
# sys.stdout.close()
# sys.stdout.close()
sys
.
stdout
=
tmpout
sys
.
stdout
=
tmpout
if
yes
:
sys
.
stdin
=
tmpin
sys
.
stdin
=
tmpin
raw_input
=
original_raw_input
raw_input
=
original_raw_input
return
card
return
card
...
@@ -109,7 +107,7 @@ class Suite(object):
...
@@ -109,7 +107,7 @@ class Suite(object):
def
__init__
(
self
,
cfgfilename
=
default_config_file
):
def
__init__
(
self
,
cfgfilename
=
default_config_file
):
self
.
required
=
[
'board'
,
'serial'
,
'extra_serial'
,
'test_path'
,
self
.
required
=
[
'board'
,
'serial'
,
'extra_serial'
,
'test_path'
,
'log_path'
,
'sequence'
]
'log_path'
,
'sequence'
]
for
fieldname
in
self
.
required
:
for
fieldname
in
self
.
required
:
self
.
__setattr__
(
fieldname
,
None
)
self
.
__setattr__
(
fieldname
,
None
)
self
.
config
=
default_config_file
self
.
config
=
default_config_file
...
@@ -276,7 +274,7 @@ class Suite(object):
...
@@ -276,7 +274,7 @@ class Suite(object):
' comment = {3}
\n
'
' comment = {3}
\n
'
' timestamp = {4}
\n
'
' timestamp = {4}
\n
'
' runid = {5}
\n
'
.
format
(
' runid = {5}
\n
'
.
format
(
self
.
board
,
self
.
serial
,
self
.
extra_serial
,
self
.
comment
,
ts
,
runid
))
self
.
board
,
self
.
serial
,
self
.
extra_serial
,
self
.
comment
,
ts
,
runid
))
failures
=
[]
failures
=
[]
for
test
in
sequence
:
for
test
in
sequence
:
try
:
try
:
...
@@ -473,33 +471,34 @@ def validate_args(args):
...
@@ -473,33 +471,34 @@ def validate_args(args):
def
main
():
def
main
():
usage
=
(
'
%
prog: [options] test ...
\n
'
usage
=
(
'
%
prog: [options] test ...
\n
'
'run
%
prog with option -h or --help for more help'
)
'run
%
prog with option -h or --help for more help'
)
parser
=
OptionParser
(
usage
)
parser
=
OptionParser
(
usage
)
parser
.
add_option
(
"-c"
,
"--config"
,
dest
=
"config"
,
parser
.
add_option
(
"-c"
,
"--config"
,
dest
=
"config"
,
default
=
default_config_file
,
default
=
default_config_file
,
help
=
"config file name"
)
help
=
"config file name"
)
parser
.
add_option
(
"-C"
,
"--cli"
,
dest
=
"cli"
,
action
=
"store_true"
,
parser
.
add_option
(
"-C"
,
"--cli"
,
dest
=
"cli"
,
action
=
"store_true"
,
help
=
"enter command-line interpreter"
)
help
=
"enter command-line interpreter"
)
parser
.
add_option
(
"-b"
,
"--board"
,
dest
=
"board"
,
parser
.
add_option
(
"-b"
,
"--board"
,
dest
=
"board"
,
help
=
"board name (e.g. -b SPEC)"
,
metavar
=
"NAME"
)
help
=
"board name (e.g. -b SPEC)"
,
metavar
=
"NAME"
)
parser
.
add_option
(
"-s"
,
"--serial"
,
dest
=
"serial"
,
parser
.
add_option
(
"-s"
,
"--serial"
,
dest
=
"serial"
,
help
=
"board serial number"
,
metavar
=
"SERIAL"
)
help
=
"board serial number"
,
metavar
=
"SERIAL"
)
parser
.
add_option
(
"-e"
,
"--extra_serial"
,
dest
=
"extra_serial"
,
parser
.
add_option
(
"-e"
,
"--extra_serial"
,
dest
=
"extra_serial"
,
help
=
"another board serial number [Optional]"
,
metavar
=
"SERIAL"
)
help
=
"another board serial number [Optional]"
,
metavar
=
"SERIAL"
)
parser
.
add_option
(
"-t"
,
"--test-path"
,
dest
=
"test_path"
,
parser
.
add_option
(
"-t"
,
"--test-path"
,
dest
=
"test_path"
,
help
=
"path to test files"
,
metavar
=
"PATH"
)
help
=
"path to test files"
,
metavar
=
"PATH"
,
default
=
os
.
getcwd
()
+
"/tests"
)
parser
.
add_option
(
"-l"
,
"--log-path"
,
dest
=
"log_path"
,
parser
.
add_option
(
"-l"
,
"--log-path"
,
dest
=
"log_path"
,
help
=
"path to log files"
,
metavar
=
"PATH"
)
help
=
"path to log files"
,
metavar
=
"PATH"
)
parser
.
add_option
(
"-n"
,
"--ntimes"
,
dest
=
"repeat"
,
parser
.
add_option
(
"-n"
,
"--ntimes"
,
dest
=
"repeat"
,
help
=
"number of times to repeat the batch of tests"
,
help
=
"number of times to repeat the batch of tests"
,
metavar
=
"NUMBER"
)
metavar
=
"NUMBER"
)
parser
.
add_option
(
"-r"
,
"--randomize"
,
action
=
"store_true"
,
parser
.
add_option
(
"-r"
,
"--randomize"
,
action
=
"store_true"
,
default
=
False
,
default
=
False
,
help
=
"run the batch in random order"
,
)
help
=
"run the batch in random order"
,
)
parser
.
add_option
(
"-w"
,
"--write-config"
,
action
=
"store_true"
,
parser
.
add_option
(
"-w"
,
"--write-config"
,
action
=
"store_true"
,
help
=
"write configuration data to config file"
,
)
help
=
"write configuration data to config file"
,
)
parser
.
add_option
(
"-y"
,
"--yes"
,
action
=
"store_true"
,
parser
.
add_option
(
"-y"
,
"--yes"
,
action
=
"store_true"
,
help
=
"assume all user interventions are affirmative"
,
)
help
=
"assume all user interventions are affirmative"
,
)
(
options
,
args
)
=
parser
.
parse_args
()
(
options
,
args
)
=
parser
.
parse_args
()
...
...
pts/python/tests/test00.py
View file @
e2b9cd63
#!/usr/bin/env python
#!/usr/bin/env python
################################################################################
# Copyright CERN, 2019
## CERN BE-CO-HT
# Author: <Dimitris.Lampridis@cern.ch>, <Evangelia.Gousiou@cern.ch>
## CONV-RS485-OPT-RTM
# Licence: GPL v2 or later.
## https://www.ohwr.org/projects/conv-rs485-opt-rtm
# Website: http://www.ohwr.org
################################################################################
##
## unit name: test00.py
##
## description: Test for reading out the RTM ID over I2C
##
################################################################################
## Copyright CERN 2019
################################################################################
##
## This program is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation, either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program. If not, see <https://www.gnu.org/licenses/>.
##
## SPDX-License-Identifier: GPL-3.0-or-later
################################################################################
# Import system modules
# Import system modules
import
sys
import
sys
...
@@ -11,6 +35,7 @@ import time
...
@@ -11,6 +35,7 @@ import time
import
os
,
errno
,
re
,
sys
,
struct
import
os
,
errno
,
re
,
sys
,
struct
import
os.path
import
os.path
import
traceback
import
traceback
import
configparser
# Import common modules
# Import common modules
sys
.
path
.
append
(
'..'
)
sys
.
path
.
append
(
'..'
)
...
@@ -19,11 +44,6 @@ import utilities as util
...
@@ -19,11 +44,6 @@ import utilities as util
import
vv_skt
import
vv_skt
from
ptsdefine
import
*
from
ptsdefine
import
*
##-------------------------------------------------------------------------------------------------
## main --
##-------------------------------------------------------------------------------------------------
def
main
(
card
=
None
,
default_directory
=
'.'
,
suite
=
None
,
serial
=
""
):
def
main
(
card
=
None
,
default_directory
=
'.'
,
suite
=
None
,
serial
=
""
):
testname
=
"Test00: DUT identification"
testname
=
"Test00: DUT identification"
...
@@ -35,7 +55,17 @@ def main (card=None, default_directory='.',suite=None, serial=""):
...
@@ -35,7 +55,17 @@ def main (card=None, default_directory='.',suite=None, serial=""):
util
.
section_msg
(
"I2C to read RTM ID"
)
util
.
section_msg
(
"I2C to read RTM ID"
)
test_results
=
{}
test_results
=
{}
dut
=
vv_skt
.
SKT
()
config
=
configparser
.
ConfigParser
()
config
.
read
(
default_directory
+
"/../../CONFIG.ini"
)
lun
=
int
(
config
[
'DUT.FEC'
][
'Slot'
])
ip
=
config
[
'DUT.FEC'
][
'MgtHostName'
]
port
=
int
(
config
[
'DUT.FEC'
][
'MgtPort'
])
user
=
config
[
'DUT.FEC'
][
'MgtUserName'
]
pwrd
=
config
[
'DUT.FEC'
][
'MgtPassword'
]
dut
=
vv_skt
.
SKT
(
lun
,
ip
,
port
,
user
,
pwrd
)
###############################################################################
###############################################################################
############################ actual test ######################################
############################ actual test ######################################
...
...
pts/python/tests/test01.py
View file @
e2b9cd63
...
@@ -42,7 +42,7 @@ def test_led_all():
...
@@ -42,7 +42,7 @@ def test_led_all():
def
main
(
card
=
None
,
default_directory
=
'.'
,
suite
=
None
,
serial
=
""
):
def
main
(
card
=
None
,
default_directory
=
'.'
,
suite
=
None
,
serial
=
""
):
testname
=
"Test0
0
: LEDs and basic connectivity"
testname
=
"Test0
1
: LEDs and basic connectivity"
util
.
header_msg
(
testname
,
[
"LED connectivity"
]
)
util
.
header_msg
(
testname
,
[
"LED connectivity"
]
)
###############################################################################
###############################################################################
...
...
pts/python/vv_skt.py
View file @
e2b9cd63
#! /usr/bin/python
#!/usr/bin/env python
# coding: utf8
################################################################################
## CERN BE-CO-HT
# Copyright CERN, 2014
## CONV-RS485-OPT-RTM
# Author: Julian Lewis <julian.lewis@cern.ch>
## https://www.ohwr.org/projects/conv-rs485-opt-rtm
# Theodor Stana <t.stana@cern.ch>
################################################################################
# Licence: GPL v2 or later.
##
# Website: http://www.ohwr.org
## unit name: vv_skt.py
##
## description: A simple python class to handle Telnet communication with an
## ELMA crate.
##
################################################################################
## Copyright CERN 2014-2019
################################################################################
##
## This program is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation, either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program. If not, see <https://www.gnu.org/licenses/>.
##
## SPDX-License-Identifier: GPL-3.0-or-later
################################################################################
import
sys
import
sys
import
time
import
time
...
@@ -22,24 +45,21 @@ import utilities as util
...
@@ -22,24 +45,21 @@ import utilities as util
class
SKT
:
class
SKT
:
def
__init__
(
self
,
lun
=
None
):
def
__init__
(
self
,
lun
,
ip
,
port
,
user
,
pwrd
):
""" Telnet access over a socket to ELMA I2C bus
""" Telnet access over a socket to ELMA I2C bus
"""
"""
slot
=
int
(
os
.
environ
[
'ELMASLOT'
])
self
.
lun
=
lun
if
type
(
lun
)
==
type
(
slot
):
self
.
ip
=
ip
self
.
lun
=
lun
self
.
port
=
port
else
:
self
.
user
=
user
self
.
lun
=
slot
self
.
pwrd
=
pwrd
#raise PtsWarning("Warning: SKT __init__: Bad lun=(slot), default to %s" % slot)
addr
=
(
self
.
ip
,
self
.
port
)
self
.
base
=
0
;
s
=
socket
.
create_connection
(
addr
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
connect
((
os
.
environ
[
'ELMAIP'
],
23
))
s
.
recv
(
256
)
s
.
recv
(
256
)
s
.
send
(
"
admin
\r\n
"
)
s
.
send
(
"
%
s
\r\n
"
%
self
.
user
)
s
.
recv
(
256
)
s
.
recv
(
256
)
s
.
send
(
os
.
environ
[
'ELMAPWD'
]
+
"
\r\n
"
)
s
.
send
(
"
%
s
\r\n
"
%
self
.
pwrd
)
s
.
recv
(
256
)
s
.
recv
(
256
)
self
.
handle
=
s
self
.
handle
=
s
...
@@ -48,14 +68,11 @@ class SKT:
...
@@ -48,14 +68,11 @@ class SKT:
ver
=
self
.
handle
.
recv
(
256
)
ver
=
self
.
handle
.
recv
(
256
)
pos
=
ver
.
find
(
"Software version"
)
pos
=
ver
.
find
(
"Software version"
)
if
(
pos
==
-
1
):
if
(
pos
==
-
1
):
util
.
crit_msg
(
"Crate
%
s not responding as expected"
%
os
.
environ
[
'ELMAIP'
])
util
.
crit_msg
(
"Crate
%
s not responding as expected"
%
self
.
addr
)
#print("Unexpected response from \"version\" command, exiting...")
#self.close()
sys
.
exit
(
2
)
sys
.
exit
(
2
)
ver
=
float
(
ver
[
pos
+
17
:
pos
+
21
])
ver
=
float
(
ver
[
pos
+
17
:
pos
+
21
])
self
.
ver
=
ver
self
.
ver
=
ver
def
vv_read
(
self
,
byte_offset
):
def
vv_read
(
self
,
byte_offset
):
""" Read from the application FPGA via ELMA telnet
""" Read from the application FPGA via ELMA telnet
The byte offset will be aligned to D32
The byte offset will be aligned to D32
...
...
pts/run-pts.sh
View file @
e2b9cd63
#!/bin/
ba
sh
#!/bin/sh
################################################################################
################################################################################
## CERN BE-CO-HT
## CERN BE-CO-HT
## CONV-RS485-OPT-RTM
## CONV-RS485-OPT-RTM
...
@@ -29,7 +29,9 @@
...
@@ -29,7 +29,9 @@
## SPDX-License-Identifier: GPL-3.0-or-later
## SPDX-License-Identifier: GPL-3.0-or-later
################################################################################
################################################################################
LOGDIR
=
"log/"
BOARD
=
"OptRtm"
LOGDIR
=
`
pwd
`
"/log/"
mkdir
-p
"
$LOGDIR
"
mkdir
-p
"
$LOGDIR
"
...
@@ -64,7 +66,9 @@ echo -n "---> Now please plug in the board and then press [ENTER]"
...
@@ -64,7 +66,9 @@ echo -n "---> Now please plug in the board and then press [ENTER]"
read
board_plugged
read
board_plugged
# run tests
# run tests
./pts.py
-b
OptRtm
-s
$serial
-e
$extra_serial
-t
./tests
-l
$LOGDIR
00 01 02
cd
python
python pts.py
-b
$BOARD
-s
$serial
-e
$extra_serial
-l
$LOGDIR
00 01 02
cd
..
echo
echo
echo
"---------------"
echo
"---------------"
...
...
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