Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FofbTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DG
FOFB
FofbTool
Commits
f8f8e899
Commit
f8f8e899
authored
11 months ago
by
BRONES Romain
Browse files
Options
Downloads
Patches
Plain Diff
Refactor CCN operations
parent
a5f7119e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
FofbTool/Operation.py
+74
-54
74 additions, 54 deletions
FofbTool/Operation.py
FofbTool/Utils.py
+3
-3
3 additions, 3 deletions
FofbTool/Utils.py
with
77 additions
and
57 deletions
FofbTool/Operation.py
+
74
−
54
View file @
f8f8e899
...
...
@@ -101,114 +101,134 @@ def align_ccn(node_tangopath, comlbpif=0):
return
None
return
seqoffset
def
stop_ccn
(
node
name
):
def
stop_ccn
(
node
_tangopath
,
ccnif
=
[]
):
"""
Stop the communication with cellnode on the specified fofbnode.
PARAMETERS
----------
nodename: str
The target fofbnode, ie
'
cellnode-c09
'
or
'
centralnode
'
node_tangopath: str
The target fofbnode tango path, ie
'
ans/dg/fofb-cellnode-c09
'
ccnif: list(int)
List of the interface to stop. If empty, all the possible interface will be stopped.
"""
prx
=
FofbTool
.
Utils
.
get_prx_from_nodename
(
nodename
)
if
prx
is
None
:
logger
.
error
(
"
Failed to stop CCN on {}
"
.
format
(
nodename
))
return
try
:
prx
=
tango
.
DeviceProxy
(
node_tangopath
)
prx
.
ping
()
except
tango
.
DevFailed
:
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
return
None
if
len
(
ccnif
)
==
0
:
ccnif
=
[
int
(
a
[
7
])
for
a
in
prx
.
get_attribute_list
()
if
"
ccnpack
"
in
a
if
"
control
"
in
a
]
logger
.
info
(
"
Stopping CCN on {}
"
.
format
(
nodename
))
nint
=
1
if
'
central
'
in
nodename
:
nint
=
4
for
n
in
range
(
nint
):
logger
.
info
(
"
Stopping CCN on {}
"
.
format
(
node_tangopath
))
for
n
in
ccnif
:
prx
[
"
ccnpack{}_control
"
.
format
(
n
)]
=
False
prx
[
"
ccnunpack{}_control
"
.
format
(
n
)]
=
False
def
reset_ccn
(
node
name
):
def
reset_ccn
(
node
_tangopath
,
ccnif
=
[]
):
"""
Reset the communication with cellnode on the specified fofbnode.
PARAMETERS
----------
nodename: str
The target fofbnode, ie
'
cellnode-c09
'
or
'
centralnode
'
node_tangopath: str
The target fofbnode tango path, ie
'
ans/dg/fofb-cellnode-c09
'
ccnif: list(int)
List of the interface to stop. If empty, all the possible interface will be stopped.
"""
prx
=
FofbTool
.
Utils
.
get_prx_from_nodename
(
nodename
)
if
prx
is
None
:
logger
.
error
(
"
Failed to reset CCN on {}
"
.
format
(
nodename
))
return
logger
.
info
(
"
Reset CCN on {}
"
.
format
(
nodename
))
nint
=
1
if
'
central
'
in
nodename
:
nint
=
4
for
n
in
range
(
nint
):
try
:
prx
=
tango
.
DeviceProxy
(
node_tangopath
)
prx
.
ping
()
except
tango
.
DevFailed
:
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
return
None
if
len
(
ccnif
)
==
0
:
ccnif
=
[
int
(
a
[
6
])
for
a
in
prx
.
get_attribute_list
()
if
"
ccneth
"
in
a
if
"
gt_reset
"
in
a
]
logger
.
info
(
"
Reset CCN on {}
"
.
format
(
node_tangopath
))
for
n
in
ccnif
:
prx
[
"
ccneth{}_reset
"
.
format
(
n
)]
=
0x60000001
# impossible to write 0xE0000001
prx
[
"
ccneth{}_gt_reset
"
.
format
(
n
)]
=
1
time
.
sleep
(
2
)
for
n
in
range
(
nint
)
:
for
n
in
ccnif
:
prx
[
"
ccneth{}_gt_reset
"
.
format
(
n
)]
=
0
prx
[
"
ccneth{}_reset
"
.
format
(
n
)]
=
0
ack_ccn
(
node
name
)
ack_ccn
(
node
_tangopath
,
ccnif
)
def
start_ccn
(
node
name
):
def
start_ccn
(
node
_tangopath
,
ccnif
=
[]
):
"""
Start the communication with cellnode on the specified fofbnode.
PARAMETERS
----------
nodename: str
The target fofbnode, ie
'
cellnode-c09
'
or
'
centralnode
'
node_tangopath: str
The target fofbnode tango path, ie
'
ans/dg/fofb-cellnode-c09
'
ccnif: list(int)
List of the interface to stop. If empty, all the possible interface will be stopped.
"""
prx
=
FofbTool
.
Utils
.
get_prx_from_nodename
(
nodename
)
if
prx
is
None
:
logger
.
error
(
"
Failed to start CCN on {}
"
.
format
(
nodename
))
return
try
:
prx
=
tango
.
DeviceProxy
(
node_tangopath
)
prx
.
ping
()
except
tango
.
DevFailed
:
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
return
None
logger
.
info
(
"
Starting CCN on {}
"
.
format
(
nodename
))
if
len
(
ccnif
)
==
0
:
ccnif
=
[
int
(
a
[
7
])
for
a
in
prx
.
get_attribute_list
()
if
"
ccnpack
"
in
a
if
"
control
"
in
a
]
ack_ccn
(
nodename
)
logger
.
info
(
"
Starting CCN on {}
"
.
format
(
node_tangopath
)
)
nint
=
1
if
'
central
'
in
nodename
:
nint
=
4
for
n
in
range
(
nint
):
prx
[
"
ccnpack{}_control
"
.
format
(
n
)]
=
True
prx
[
"
ccnunpack{}_control
"
.
format
(
n
)]
=
True
ack_ccn
(
node_tangopath
,
ccnif
)
def
ack_ccn
(
nodename
):
for
n
in
ccnif
:
prx
[
"
ccnpack{}_control
"
.
format
(
n
)]
=
1
prx
[
"
ccnunpack{}_control
"
.
format
(
n
)]
=
1
def
ack_ccn
(
node_tangopath
,
ccnif
=
[]):
"""
Start the communication with cellnode on the specified fofbnode.
PARAMETERS
----------
nodename: str
The target fofbnode, ie
'
cellnode-c09
'
or
'
centralnode
'
node_tangopath: str
The target fofbnode tango path, ie
'
ans/dg/fofb-cellnode-c09
'
ccnif: list(int)
List of the interface to stop. If empty, all the possible interface will be stopped.
"""
prx
=
FofbTool
.
Utils
.
get_prx_from_nodename
(
nodename
)
if
prx
is
None
:
logger
.
error
(
"
Failed to ack CCN on {}
"
.
format
(
nodename
))
return
try
:
prx
=
tango
.
DeviceProxy
(
node_tangopath
)
prx
.
ping
()
except
tango
.
DevFailed
:
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
return
None
if
len
(
ccnif
)
==
0
:
ccnif
=
[
int
(
a
[
7
])
for
a
in
prx
.
get_attribute_list
()
if
"
ccnpack
"
in
a
if
"
control
"
in
a
]
logger
.
info
(
"
Ack CCN error on {}
"
.
format
(
nodename
))
nint
=
1
if
'
central
'
in
nodename
:
nint
=
4
for
n
in
range
(
nint
):
logger
.
info
(
"
Ack CCN error on {}
"
.
format
(
node_tangopath
))
for
n
in
ccnif
:
prx
[
"
ccnpack{}_reset_error
"
.
format
(
n
)]
=
True
prx
[
"
ccnunpack{}_reset_error
"
.
format
(
n
)]
=
True
time
.
sleep
(
1
)
for
n
in
range
(
nint
)
:
for
n
in
ccnif
:
prx
[
"
ccnpack{}_reset_error
"
.
format
(
n
)]
=
False
prx
[
"
ccnunpack{}_reset_error
"
.
format
(
n
)]
=
False
...
...
This diff is collapsed.
Click to expand it.
FofbTool/Utils.py
+
3
−
3
View file @
f8f8e899
...
...
@@ -276,8 +276,8 @@ def stop_all_ccn(force=False):
return
for
n
,
p
in
FofbTool
.
Configuration
.
config
[
"
tangopath.fofbnodes
"
].
items
():
FofbTool
.
Operation
.
stop_ccn
(
n
)
FofbTool
.
Operation
.
reset_ccn
(
n
)
FofbTool
.
Operation
.
stop_ccn
(
p
)
FofbTool
.
Operation
.
reset_ccn
(
p
)
...
...
@@ -313,7 +313,7 @@ def start_all_ccn():
"""
for
n
,
p
in
FofbTool
.
Configuration
.
config
[
"
tangopath.fofbnodes
"
].
items
():
FofbTool
.
Operation
.
start_ccn
(
n
)
FofbTool
.
Operation
.
start_ccn
(
p
)
def
align_all_ccn
(
cellnodename
,
force
=
False
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment