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
135da67e
Commit
135da67e
authored
3 months ago
by
Aude Grabas
Browse files
Options
Downloads
Patches
Plain Diff
GBE capability: extract mac size from ccnpack
parent
57012ecd
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/Configuration.py
+128
-11
128 additions, 11 deletions
FofbTool/Configuration.py
FofbTool/Operation.py
+9
-10
9 additions, 10 deletions
FofbTool/Operation.py
with
137 additions
and
21 deletions
FofbTool/Configuration.py
+
128
−
11
View file @
135da67e
...
@@ -162,48 +162,120 @@ def centralnode_configure_comgbe(node_tangopath, npsc):
...
@@ -162,48 +162,120 @@ def centralnode_configure_comgbe(node_tangopath, npsc):
logger
.
info
(
"
{} psc expected in the ethernet frame on {}
"
.
format
(
npsc
,
node_tangopath
))
logger
.
info
(
"
{} psc expected in the ethernet frame on {}
"
.
format
(
npsc
,
node_tangopath
))
logger
.
info
(
"
Configure packeter npackets to {}
"
.
format
(
npsc
-
1
))
logger
.
info
(
"
Configure packeter npackets to {}
"
.
format
(
npsc
-
1
))
for
n
in
range
(
1
):
for
n
in
range
(
1
):
prx
[
"
ccn
pack
eth
{}_npackets
"
.
format
(
n
)]
=
npsc
-
1
prx
[
"
gigeth
pack{}_npackets
"
.
format
(
n
)]
=
npsc
-
1
#maclen = npsc*4+10+20+8
#maclen = npsc*4+10+20+8
#logger.info("Configure packeter framesize (mac length) to {}".format(maclen))
#logger.info("Configure packeter framesize (mac length) to {}".format(maclen))
#prx["ccnpacketh{}_framesize".format(n)] = maclen
#prx["ccnpacketh{}_framesize".format(n)] = maclen
maclen
=
0x0800
maclen
=
0x0800
logger
.
info
(
"
Configure IP protocol to {}
"
.
format
(
hex
(
maclen
)))
logger
.
info
(
"
Configure IP protocol to {}
"
.
format
(
hex
(
maclen
)))
prx
[
"
ethhead{}_framesize
"
.
format
(
n
)]
=
int
(
maclen
)
prx
[
"
gig
ethhead{}_framesize
"
.
format
(
n
)]
=
int
(
maclen
)
ipv
=
4
ipv
=
4
logger
.
info
(
"
Configure IP version to {}
"
.
format
(
hex
(
ipv
)))
logger
.
info
(
"
Configure IP version to {}
"
.
format
(
hex
(
ipv
)))
prx
[
"
ethhead{}_ipv
"
.
format
(
n
)]
=
ipv
prx
[
"
gig
ethhead{}_ipv
"
.
format
(
n
)]
=
ipv
ipihl
=
5
ipihl
=
5
logger
.
info
(
"
Configure IP Header Length to {}
"
.
format
(
hex
(
ipihl
)))
logger
.
info
(
"
Configure IP Header Length to {}
"
.
format
(
hex
(
ipihl
)))
prx
[
"
ethhead{}_ipihl
"
.
format
(
n
)]
=
ipihl
prx
[
"
gig
ethhead{}_ipihl
"
.
format
(
n
)]
=
ipihl
iplength
=
(
npsc
*
4
+
4
)
+
20
+
8
iplength
=
(
npsc
*
4
+
4
)
+
20
+
8
prx
[
"
ethhead{}_iplength
"
.
format
(
n
)]
=
iplength
prx
[
"
gig
ethhead{}_iplength
"
.
format
(
n
)]
=
iplength
logger
.
info
(
"
IP length configured to {}
"
.
format
(
iplength
))
logger
.
info
(
"
IP length configured to {}
"
.
format
(
iplength
))
#ipdest=np.uint(0xa9fe0102) #bug found here --> not possible to set up uint32 to pyTango
#ipdest=np.uint(0xa9fe0102) #bug found here --> not possible to set up uint32 to pyTango
#logger.error(ipdest)
#logger.error(ipdest)
#prx["ethhead{}_ipdst".format(n)] = ipdest
#prx["
gig
ethhead{}_ipdst".format(n)] = ipdest
#logger.debug("IP dest configured to {}".format(ipdest))
#logger.debug("IP dest configured to {}".format(ipdest))
ipchksum
=
ipheadchk_cmp
(
0x4500
,
int
(
hex
(
iplength
),
16
),
0x8011
,
0xa9fe
,
0x0101
,
0xa9fe
,
0x0102
)
ipchksum
=
ipheadchk_cmp
(
0x4500
,
int
(
hex
(
iplength
),
16
),
0x8011
,
0xa9fe
,
0x0101
,
0xa9fe
,
0x0102
)
prx
[
"
ethhead{}_ipchksum
"
.
format
(
n
)]
=
int
(
ipchksum
)
prx
[
"
gig
ethhead{}_ipchksum
"
.
format
(
n
)]
=
int
(
ipchksum
)
logger
.
info
(
"
IP chksum configured to {}
"
.
format
(
ipchksum
))
logger
.
info
(
"
IP chksum configured to {}
"
.
format
(
ipchksum
))
udplength
=
(
npsc
*
4
+
4
)
+
8
udplength
=
(
npsc
*
4
+
4
)
+
8
prx
[
"
ethhead{}_udplength
"
.
format
(
n
)]
=
udplength
prx
[
"
gig
ethhead{}_udplength
"
.
format
(
n
)]
=
udplength
logger
.
info
(
"
UDP length configured to {}
"
.
format
(
udplength
))
logger
.
info
(
"
UDP length configured to {}
"
.
format
(
udplength
))
udpport
=
0x75317531
udpport
=
0x75317531
prx
[
"
ethhead{}_udpport
"
.
format
(
n
)]
=
int
(
udpport
)
prx
[
"
gig
ethhead{}_udpport
"
.
format
(
n
)]
=
int
(
udpport
)
logger
.
info
(
"
UDP ports (src&dest) configured to {}
"
.
format
(
hex
(
udpport
)))
logger
.
info
(
"
UDP ports (src&dest) configured to {}
"
.
format
(
hex
(
udpport
)))
udpchksum
=
0x00
udpchksum
=
0x00
prx
[
"
ethhead{}_udpchksum
"
.
format
(
n
)]
=
udpchksum
prx
[
"
gig
ethhead{}_udpchksum
"
.
format
(
n
)]
=
int
(
udpchksum
)
logger
.
info
(
"
UDP ports chksum configured to {}
"
.
format
(
udpchksum
))
logger
.
info
(
"
UDP ports chksum configured to {}
"
.
format
(
udpchksum
))
logger
.
info
(
"
Configuration of Com GBE done on {}.
"
.
format
(
node_tangopath
))
logger
.
info
(
"
Configuration of Com GBE done on {}.
"
.
format
(
node_tangopath
))
return
True
return
True
###################################################################################################
def
cellnode_configure_ccn
(
node_tangopath
,
nbpm
,
npsc
):
"""
Configure the ComCellNode block on a cellnode.
Automatically set the number of bpm/psc packets and MAC length.
PARAMETERS
----------
node_tangopath: str
The target fofbnode tango path, ie
'
ans/dg/fofb-cellnode-c09
'
nbpm:
Number of BPM allowed by the filter, hence the number of expected BPM packets.
npsc:
Number of total PSC, hence the number of expected PSC packets.
RETURN
------
success: boolean
True if configuration is a success
"""
# Get device proxy
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
.
debug
(
"
{} bpm allowed in the ethernet frame on {}
"
.
format
(
nbpm
,
node_tangopath
))
logger
.
debug
(
"
{} psc expected in the ethernet frame on {}
"
.
format
(
npsc
,
node_tangopath
))
maclen
=
10
*
nbpm
+
10
logger
.
debug
(
"
Configure packeter framesize (mac length) to {}
"
.
format
(
maclen
))
prx
[
"
ccnpack0_framesize
"
]
=
maclen
logger
.
debug
(
"
Configure packeter npackets to {}
"
.
format
(
nbpm
-
1
))
prx
[
"
ccnpack0_npackets
"
]
=
nbpm
-
1
maclen
=
npsc
*
6
+
10
logger
.
debug
(
"
Configure unpacketer framesize (mac length) to {}
"
.
format
(
maclen
))
prx
[
"
ccnunpack0_framesize
"
]
=
maclen
logger
.
info
(
"
Configuration of CCN done on {}.
"
.
format
(
node_tangopath
))
return
True
# Get device proxy
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
.
debug
(
"
{} bpm allowed in the ethernet frame on {}
"
.
format
(
nbpm
,
node_tangopath
))
logger
.
debug
(
"
{} psc expected in the ethernet frame on {}
"
.
format
(
npsc
,
node_tangopath
))
maclen
=
10
*
nbpm
+
10
logger
.
debug
(
"
Configure packeter framesize (mac length) to {}
"
.
format
(
maclen
))
prx
[
"
ccnpack0_framesize
"
]
=
maclen
logger
.
debug
(
"
Configure packeter npackets to {}
"
.
format
(
nbpm
-
1
))
prx
[
"
ccnpack0_npackets
"
]
=
nbpm
-
1
maclen
=
npsc
*
6
+
10
logger
.
debug
(
"
Configure unpacketer framesize (mac length) to {}
"
.
format
(
maclen
))
prx
[
"
ccnunpack0_framesize
"
]
=
maclen
logger
.
info
(
"
Configuration of CCN done on {}.
"
.
format
(
node_tangopath
))
return
True
###################################################################################################
###################################################################################################
...
@@ -257,8 +329,9 @@ def cellnode_configure_ccn(node_tangopath, nbpm, npsc):
...
@@ -257,8 +329,9 @@ def cellnode_configure_ccn(node_tangopath, nbpm, npsc):
logger
.
info
(
"
Configuration of CCN done on {}.
"
.
format
(
node_tangopath
))
logger
.
info
(
"
Configuration of CCN done on {}.
"
.
format
(
node_tangopath
))
return
True
return
True
@trycatch_tango_devfailed
@trycatch_tango_devfailed
def
centralnode_configure_ccn
_w_gbe
(
node_tangopath
,
nbpm
,
npsc
):
def
centralnode_configure_ccn
(
node_tangopath
,
nbpm
,
npsc
):
"""
"""
Configure the ComCellNode block on the centralnode.
Configure the ComCellNode block on the centralnode.
Automatically set the number of bpm/psc packets and MAC length.
Automatically set the number of bpm/psc packets and MAC length.
...
@@ -286,6 +359,50 @@ def centralnode_configure_ccn_w_gbe(node_tangopath, nbpm, npsc):
...
@@ -286,6 +359,50 @@ def centralnode_configure_ccn_w_gbe(node_tangopath, nbpm, npsc):
return
None
return
None
for
n
in
range
(
len
(
nbpm
)):
for
n
in
range
(
len
(
nbpm
)):
maclen
=
npsc
*
6
+
10
logger
.
debug
(
"
Configure packeter {} framesize (mac length) to {}
"
.
format
(
n
,
maclen
))
prx
[
"
ccnpack{}_framesize
"
.
format
(
n
)]
=
maclen
logger
.
debug
(
"
Configure packeter {} npackets to {}
"
.
format
(
n
,
npsc
-
1
))
prx
[
"
ccnpack{}_npackets
"
.
format
(
n
)]
=
npsc
-
1
maclen
=
10
*
nbpm
[
n
]
+
10
logger
.
debug
(
"
Configure unpacketer {} framesize (mac length) to {}
"
.
format
(
n
,
maclen
))
prx
[
"
ccnunpack{}_framesize
"
.
format
(
n
)]
=
maclen
logger
.
info
(
"
Configuration of CCN done on {}.
"
.
format
(
node_tangopath
))
logger
.
info
(
"
Configuration of CCN done on {}.
"
.
format
(
node_tangopath
))
return
True
@trycatch_tango_devfailed
def
centralnode_configure_ccn_w_gbe
(
node_tangopath
,
nbpm
,
npsc
):
"""
Configure the ComCellNode block on the centralnode.
Automatically set the number of bpm/psc packets and MAC length.
PARAMETERS
----------
node_tangopath: str
The target fofbnode tango path, ie
'
ans/dg/fofb-centralnode
'
nbpm: list(int)
Number of BPM packet received on each interface.
npsc:
Number of total PSC, hence the number of expected PSC packets.
RETURN
------
success: boolean
True if configuration is a success
"""
# Get device proxy
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
for
n
in
range
(
4
):
maclen
=
npsc
*
4
+
4
maclen
=
npsc
*
4
+
4
logger
.
debug
(
"
Configure packeter {} framesize (mac length) to {}
"
.
format
(
n
,
maclen
))
logger
.
debug
(
"
Configure packeter {} framesize (mac length) to {}
"
.
format
(
n
,
maclen
))
prx
[
"
ccnethhead{}_framesize
"
.
format
(
n
)]
=
maclen
prx
[
"
ccnethhead{}_framesize
"
.
format
(
n
)]
=
maclen
...
...
This diff is collapsed.
Click to expand it.
FofbTool/Operation.py
+
9
−
10
View file @
135da67e
...
@@ -318,7 +318,7 @@ def reset_gbe(node_tangopath, ccnif=[]):
...
@@ -318,7 +318,7 @@ def reset_gbe(node_tangopath, ccnif=[]):
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
return
False
return
False
if
len
(
ccnif
)
==
0
:
if
len
(
ccnif
)
==
0
:
ccnif
=
[
int
(
a
[
6
])
for
a
in
prx
.
get_attribute_list
()
if
"
gigeth
"
in
a
if
"
reset
"
in
a
]
ccnif
=
[
int
(
a
[
6
])
for
a
in
prx
.
get_attribute_list
()
if
"
gigeth
"
in
a
if
"
reset
"
in
a
if
not
"
error
"
in
a
]
logger
.
info
(
"
Reset GBE on {}
"
.
format
(
node_tangopath
))
logger
.
info
(
"
Reset GBE on {}
"
.
format
(
node_tangopath
))
for
n
in
ccnif
:
for
n
in
ccnif
:
prx
[
"
gigeth{}_reset
"
.
format
(
n
)]
=
1
prx
[
"
gigeth{}_reset
"
.
format
(
n
)]
=
1
...
@@ -357,13 +357,13 @@ def start_gbe(node_tangopath, ccnif=[]):
...
@@ -357,13 +357,13 @@ def start_gbe(node_tangopath, ccnif=[]):
except
tango
.
DevFailed
:
except
tango
.
DevFailed
:
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
return
False
return
False
if
len
(
ccnif
)
==
0
:
#
if len(ccnif) == 0:
ccnif
=
[
int
(
a
[
10
])
for
a
in
prx
.
get_attribute_list
()
if
"
ccn
pack
eth
"
in
a
if
"
control
"
in
a
]
ccnif
=
[
int
(
a
[
10
])
for
a
in
prx
.
get_attribute_list
()
if
"
gigeth
pack
"
in
a
if
"
control
"
in
a
]
reset_gbe
(
node_tangopath
,
ccnif
)
reset_gbe
(
node_tangopath
,
ccnif
)
logger
.
info
(
"
Starting GBE on {}
"
.
format
(
node_tangopath
))
logger
.
info
(
"
Starting GBE on {}
"
.
format
(
node_tangopath
))
for
n
in
ccnif
:
for
n
in
ccnif
:
if
'
central
'
in
node_tangopath
:
if
'
central
'
in
node_tangopath
:
prx
[
"
ccn
pack
eth
{}_control
"
.
format
(
n
)]
=
1
prx
[
"
gigeth
pack{}_control
"
.
format
(
n
)]
=
1
else
:
else
:
pass
pass
logger
.
info
(
"
COM GBE started on {}
"
.
format
(
node_tangopath
))
logger
.
info
(
"
COM GBE started on {}
"
.
format
(
node_tangopath
))
...
@@ -395,15 +395,15 @@ def ack_gbe(node_tangopath, ccnif=[]):
...
@@ -395,15 +395,15 @@ def ack_gbe(node_tangopath, ccnif=[]):
return
False
return
False
if
len
(
ccnif
)
==
0
:
if
len
(
ccnif
)
==
0
:
ccnif
=
[
int
(
a
[
10
])
for
a
in
prx
.
get_attribute_list
()
if
"
ccn
pack
eth
"
in
a
if
"
control
"
in
a
]
ccnif
=
[
int
(
a
[
10
])
for
a
in
prx
.
get_attribute_list
()
if
"
gigeth
pack
"
in
a
if
"
control
"
in
a
]
logger
.
info
(
"
Ack GBE error on {}
"
.
format
(
node_tangopath
))
logger
.
info
(
"
Ack GBE error on {}
"
.
format
(
node_tangopath
))
for
n
in
ccnif
:
for
n
in
ccnif
:
prx
[
"
ccn
pack
eth
{}_reset_error
"
.
format
(
n
)]
=
1
prx
[
"
gigeth
pack{}_reset_error
"
.
format
(
n
)]
=
1
time
.
sleep
(
1
)
time
.
sleep
(
1
)
for
n
in
ccnif
:
for
n
in
ccnif
:
prx
[
"
ccn
pack
eth
{}_reset_error
"
.
format
(
n
)]
=
0
prx
[
"
gigeth
pack{}_reset_error
"
.
format
(
n
)]
=
0
logger
.
info
(
"
ACK GBE error on {} done
"
.
format
(
node_tangopath
))
logger
.
info
(
"
ACK GBE error on {} done
"
.
format
(
node_tangopath
))
return
True
return
True
...
@@ -424,7 +424,6 @@ def stop_gbe(node_tangopath, ccnif=[]):
...
@@ -424,7 +424,6 @@ def stop_gbe(node_tangopath, ccnif=[]):
-------
-------
bool: success
bool: success
"""
"""
try
:
try
:
prx
=
tango
.
DeviceProxy
(
node_tangopath
)
prx
=
tango
.
DeviceProxy
(
node_tangopath
)
prx
.
ping
()
prx
.
ping
()
...
@@ -432,11 +431,11 @@ def stop_gbe(node_tangopath, ccnif=[]):
...
@@ -432,11 +431,11 @@ def stop_gbe(node_tangopath, ccnif=[]):
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
logger
.
error
(
"
Failed to obtain tango proxy or to ping to {}
"
.
format
(
node_tangopath
))
return
False
return
False
if
len
(
ccnif
)
==
0
:
if
len
(
ccnif
)
==
0
:
ccnif
=
[
int
(
a
[
10
])
for
a
in
prx
.
get_attribute_list
()
if
"
ccn
pack
eth
"
in
a
if
"
control
"
in
a
]
ccnif
=
[
int
(
a
[
10
])
for
a
in
prx
.
get_attribute_list
()
if
"
gigeth
pack
"
in
a
if
"
control
"
in
a
]
logger
.
info
(
"
Stopping GBE com on {}
"
.
format
(
node_tangopath
))
logger
.
info
(
"
Stopping GBE com on {}
"
.
format
(
node_tangopath
))
for
n
in
ccnif
:
for
n
in
ccnif
:
if
'
central
'
in
node_tangopath
:
if
'
central
'
in
node_tangopath
:
prx
[
"
ccn
pack
eth
{}_control
"
.
format
(
n
)]
=
False
prx
[
"
gigeth
pack{}_control
"
.
format
(
n
)]
=
False
reset_gbe
(
node_tangopath
,
ccnif
)
reset_gbe
(
node_tangopath
,
ccnif
)
return
True
return
True
...
...
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