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
Nirina Malard
slapos
Commits
0d38b560
Commit
0d38b560
authored
Aug 17, 2023
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
3cc18a43
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
7 deletions
+22
-7
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+3
-3
software/ors-amarisoft/instance-enb.jinja2.cfg
software/ors-amarisoft/instance-enb.jinja2.cfg
+2
-0
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
+15
-2
software/ors-amarisoft/lopcomm-rrh-stats.jinja2.py
software/ors-amarisoft/lopcomm-rrh-stats.jinja2.py
+2
-2
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
0d38b560
...
...
@@ -28,7 +28,7 @@ md5sum = c930c28365c685a6066f382c9b5d8893
[lopcomm-rrh-stats.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-stats.jinja2.py
md5sum =
4c4166617617988c3fd67c9adb6792e9
md5sum =
881a26d21ffb315e7d2eb8799d2f71bb
[lopcomm-rrh-config.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-config.jinja2.py
...
...
@@ -36,11 +36,11 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d
[lopcomm-rrh-software.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-software.jinja2.py
md5sum =
a0387f81cbefec87429b119b429148b
4
md5sum =
4eb02bab7ba6a7a482c2b9bad0a3c08
4
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum =
9b720197ae47592bb2d180bf2b937cab
md5sum =
ad247f0ef9bc1ffd28fe2abee1cf6ed8
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
...
...
software/ors-amarisoft/instance-enb.jinja2.cfg
View file @
0d38b560
...
...
@@ -276,11 +276,13 @@ output = ${directory:script}/lopcomm-rrh-config.py
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-software.log
software-json-log-output = ${directory:var}/log/lopcomm-rrh-software.json.log
context =
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
key log_file :log-output
key software_json_log_file :software-json-log-output
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw software_install_template {{ software_install_template }}
...
...
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
View file @
0d38b560
...
...
@@ -15,15 +15,23 @@ class LopcommNetconfClient:
def
__init__
(
self
):
log_file
=
"{{ log_file }}"
software_json_log_file
=
"{{ software_json_log_file }}"
self
.
logger
=
logging
.
getLogger
(
'logger'
)
self
.
software_json_logger
=
logging
.
getLogger
(
'software_json_logger'
)
self
.
logger
.
setLevel
(
logging
.
DEBUG
)
self
.
software_json_logger
.
setLevel
(
logging
.
DEBUG
)
handler
=
RotatingFileHandler
(
log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
self
.
logger
.
addHandler
(
handler
)
formatter
=
logging
.
Formatter
(
"%(asctime)s [%(levelname)s] %(message)s"
)
handler
.
setFormatter
(
formatter
)
software_json_handler
=
RotatingFileHandler
(
software_json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
software_json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
software_json_handler
.
setFormatter
(
software_json_formatter
)
self
.
software_json_logger
.
addHandler
(
software_json_handler
)
if
{{
testing
}}:
return
...
...
@@ -53,6 +61,7 @@ class LopcommNetconfClient:
response
=
self
.
conn
.
dispatch
(
to_ele
(
rpc_xml
))
if
response
.
ok
:
self
.
logger
.
info
(
'Custom RPC request sent successfully'
)
return
response
.
xml
else
:
self
.
logger
.
error
(
'Error sending custom RPC request: %s'
%
response
.
error
)
except
RPCError
as
e
:
...
...
@@ -72,11 +81,15 @@ if __name__ == '__main__':
custom_rpc_xml
=
"""
<software-install xmlns="urn:o-ran:software-management:1.0">
<slot-name>slot-1</slot-name>
<file-names>PR.PRM61C70V1002.K010927.tar.g</file-names>
<file-names>PR.PRM61C70V1002.K010927.tar.g
z
</file-names>
</software-install>
"""
reply_xml
=
nc
.
custom_rpc_request
(
custom_rpc_xml
)
if
reply_xml
is
not
None
:
# Process and log the reply XML as needed
data_dict
xmltodict
.
parse
(
reply_xml
.
_raw
)
self
.
software_json_logger
.
info
(
''
,
extra
=
{
'data'
:
data_dict
})(
reply_xml
)
nc
.
custom_rpc_request
(
custom_rpc_xml
)
break
except
Exception
as
e
:
nc
.
logger
.
debug
(
'Got exception, waiting 10 seconds before reconnecting...'
)
...
...
software/ors-amarisoft/lopcomm-rrh-stats.jinja2.py
View file @
0d38b560
...
...
@@ -109,8 +109,8 @@ class LopcommNetconfClient:
self
.
supervision_json_logger
.
info
(
''
,
extra
=
{
'data'
:
data_dict
})
elif
'netconf-session-start'
in
data_dict
[
'notification'
]
or
'netconf-session-end'
in
data_dict
[
'notification'
]:
self
.
ncsession_json_logger
.
info
(
''
,
extra
=
{
'data'
:
data_dict
})
elif
'install-event'
in
data_dict
[
'notification'
]
or
'activation-event'
in
data_dict
[
'notification'
]
:
self
.
software_json_logger
.
info
(
''
,
extra
=
{
'data'
:
data_dict
})
elif
any
(
event
in
data_dict
[
'notification'
]
for
event
in
[
'install-event'
,
'activation-event'
,
'download-event'
])
:
self
.
software_json_logger
.
info
(
''
,
extra
=
{
'data'
:
data_dict
})
else
:
self
.
cfg_json_logger
.
info
(
''
,
extra
=
{
'data'
:
data_dict
})
...
...
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