Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tom Niget
slapos
Commits
0ac5e366
Commit
0ac5e366
authored
Jan 30, 2023
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vswr promise
parent
14af8f98
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
7 deletions
+113
-7
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+5
-1
software/ors-amarisoft/instance-enb.jinja2.cfg
software/ors-amarisoft/instance-enb.jinja2.cfg
+14
-1
software/ors-amarisoft/promise/check_vswr.py
software/ors-amarisoft/promise/check_vswr.py
+94
-0
software/ors-amarisoft/software.cfg
software/ors-amarisoft/software.cfg
+0
-5
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
0ac5e366
...
...
@@ -32,7 +32,7 @@ md5sum = 833667743c693b8d5f78a2527b275a9e
[template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum =
61cbcd637e8661502d5b30f44a882fa3
md5sum =
2c933e03536f570d35d01432769479df
[template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg
...
...
@@ -121,3 +121,7 @@ md5sum = 6812310b65c2d95815afc2b034a5f90f
[interface-up-promise]
_update_hash_filename_ = promise/check_interface_up.py
md5sum = 44ae5693f62b7a4dbc98f700f68d8600
[vswr-promise]
_update_hash_filename_ = promise/check_vswr.py
md5sum = fb1d32d0753f28708742f17950c18df7
software/ors-amarisoft/instance-enb.jinja2.cfg
View file @
0ac5e366
...
...
@@ -5,12 +5,15 @@ parts =
lte-enb-config
lte-enb-service
amarisoft-stats-service
lopcomm-rrh-stats-service
sdr-busy-promise
cell-gain-saturated-promise
rx-saturated-promise
baseband-latency-promise
amarisoft-stats-log-promise
{% if slapparameter_dict.get('rrh', '') == "Lopcomm ORAN" %}
lopcomm-rrh-stats-service
vswr-promise
{% endif %}
{% if not slapparameter_dict.get("sub-instance", False) %}
cpu-temperature-promise
{% endif %}
...
...
@@ -230,6 +233,16 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
config-min-txrx-delay = {{ slapparameter_dict.get("min_txrx_delay", 5) }}
config-avg-txrx-delay = {{ slapparameter_dict.get("avg_txrx_delay", 7) }}
[vswr-promise]
recipe = slapos.cookbook:promise.plugin
eggs =
slapos.core
python-dateutil
file = {{ vswr_promise }}
output = ${directory:plugins}/check-vswr.py
config-testing = {{ slapparameter_dict.get("testing", False) }}
config-lopcomm-stats-log = ${lopcomm-rrh-stats-template:json-log-output}
[amarisoft-stats-log-promise]
recipe = slapos.cookbook:promise.plugin
eggs =
...
...
software/ors-amarisoft/promise/check_vswr.py
0 → 100644
View file @
0ac5e366
import
errno
import
json
import
logging
import
os
from
dateutil
import
parser
from
zope.interface
import
implementer
from
slapos.grid.promise
import
interface
from
slapos.grid.promise.generic
import
GenericPromise
# Get all data in the last "interval" seconds from JSON log
def
get_data_interval
(
log
,
interval
):
log_number
=
0
latest_timestamp
=
0
data_list
=
[]
while
True
:
try
:
f
=
open
(
"{}.{}"
.
format
(
log
,
log_number
)
if
log_number
else
log
,
"rb"
)
except
OSError
:
return
data_list
try
:
f
.
seek
(
0
,
os
.
SEEK_END
)
while
True
:
try
:
while
f
.
seek
(
-
2
,
os
.
SEEK_CUR
)
and
f
.
read
(
1
)
!=
b'
\
n
'
:
pass
except
OSError
:
break
pos
=
f
.
tell
()
l
=
json
.
loads
(
f
.
readline
().
decode
().
replace
(
"'"
,
'"'
))
timestamp
=
parser
.
parse
(
l
[
'time'
])
data_list
.
append
(
l
[
'data'
])
if
not
latest_timestamp
:
latest_timestamp
=
timestamp
if
(
latest_timestamp
-
timestamp
).
total_seconds
()
>
interval
:
return
data_list
f
.
seek
(
pos
,
os
.
SEEK_SET
)
finally
:
f
.
close
()
log_number
+=
1
@
implementer
(
interface
.
IPromise
)
class
RunPromise
(
GenericPromise
):
def
__init__
(
self
,
config
):
self
.
__name
=
config
.
get
(
'name'
,
None
)
self
.
__log_folder
=
config
.
get
(
'log-folder'
,
None
)
super
(
RunPromise
,
self
).
__init__
(
config
)
self
.
setPeriodicity
(
minute
=
1
)
self
.
__title
=
os
.
path
.
splitext
(
self
.
__name
)[
0
]
self
.
__log_file
=
os
.
path
.
join
(
self
.
__log_folder
,
'%s.json.log'
%
self
.
__title
)
self
.
json_logger
=
logging
.
getLogger
(
'json_logger'
)
self
.
json_logger
.
setLevel
(
logging
.
INFO
)
handler
=
logging
.
FileHandler
(
self
.
__log_file
)
formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
handler
.
setFormatter
(
formatter
)
self
.
json_logger
.
addHandler
(
handler
)
def
sense
(
self
):
testing
=
self
.
getConfig
(
'testing'
)
==
"True"
if
testing
:
self
.
logger
.
info
(
"skipping promise"
)
return
lopcomm_stats_log
=
self
.
getConfig
(
'lopcomm-stats-log'
)
self
.
logger
.
error
(
lopcomm_stats_log
)
def
test
(
self
):
"""
Called after sense() if the instance is still converging.
Returns success or failure based on sense results.
In this case, fail if the previous sensor result is negative.
"""
return
self
.
_test
(
result_count
=
1
,
failure_amount
=
1
)
def
anomaly
(
self
):
"""
Called after sense() if the instance has finished converging.
Returns success or failure based on sense results.
Failure signals the instance has diverged.
In this case, fail if two out of the last three results are negative.
"""
return
self
.
_anomaly
(
result_count
=
1
,
failure_amount
=
1
)
software/ors-amarisoft/software.cfg
View file @
0ac5e366
...
...
@@ -138,14 +138,9 @@ eggs =
${bcrypt:egg}
xmltodict
ncclient
# setup-eggs =
# setuptools_scm[toml]
interpreter = pythonwitheggs
[versions]
websocket-client = 1.4.2
ncclient = 0.6.13
xmltodict = 0.13.0
# pkgutil-resolve-name = 1.3.10
# setuptools-scm = 3.5.0
# importlib-resources = 5.4.0
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