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
368568b5
Commit
368568b5
authored
Aug 17, 2023
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
771bc9ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
13 deletions
+35
-13
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+1
-1
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
+34
-12
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
368568b5
...
@@ -36,7 +36,7 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d
...
@@ -36,7 +36,7 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d
[lopcomm-rrh-software.jinja2.py]
[lopcomm-rrh-software.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-software.jinja2.py
_update_hash_filename_ = lopcomm-rrh-software.jinja2.py
md5sum =
4d43bd9e7e4c8f07078e1e1b2b732dc2
md5sum =
cc23b3e09144753e2f53841b1426ee18
[template-enb]
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
_update_hash_filename_ = instance-enb.jinja2.cfg
...
...
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
View file @
368568b5
...
@@ -77,20 +77,42 @@ if __name__ == '__main__':
...
@@ -77,20 +77,42 @@ if __name__ == '__main__':
try
:
try
:
#nc.connect("{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}", 830, "oranuser", "oranpassword")
#nc.connect("{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}", 830, "oranuser", "oranpassword")
nc
.
connect
(
"fe80::20a:ff:fe00:1020%slaptap6"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
connect
(
"fe80::20a:ff:fe00:1020%slaptap6"
,
830
,
"oranuser"
,
"oranpassword"
)
# Load your custom RPC XML from a file or construct it manually
# Fetch software inventory
custom_rpc_xml
=
"""
inventory_rpc_xml
=
"""
<software-install xmlns="urn:o-ran:software-management:1.0">
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<slot-name>slot-1</slot-name>
<filter type="subtree">
<file-names>PR.PRM61C70V1002.K010927.tar.gz</file-names>
<software-inventory xmlns="urn:o-ran:software-management:1.0" />
</software-install>
</filter>
</get>
"""
"""
reply_xml
=
nc
.
custom_rpc_request
(
custom_rpc_xml
)
inventory_reply_xml
=
nc
.
custom_rpc_request
(
inventory_rpc_xml
)
if
reply_xml
is
not
None
:
# Process and log the reply XML as needed
if
inventory_reply_xml
:
data_dict
xmltodict
.
parse
(
reply_xml
.
_raw
)
inventory_data
=
xmltodict
.
parse
(
inventory_reply_xml
)
self
.
software_output_json_logger
.
info
(
''
,
extra
=
{
'data'
:
data_dict
})(
reply_xml
)
nc
.
software_output_json_logger
.
info
(
''
,
extra
=
{
'data'
:
inventory_data
})
# Find active software slot
active_slot_name
=
None
software_slots
=
inventory_data
[
'nc:rpc-reply'
][
'data'
][
'software-inventory'
][
'software-slot'
]
for
slot
in
software_slots
:
if
slot
[
'active'
]
==
'true'
:
active_slot_name
=
slot
[
'name'
]
break
if
active_slot_name
:
# Install software in the active slot
install_rpc_xml
=
f"""
<software-install xmlns="urn:o-ran:software-management:1.0">
<slot-name>
{
active_slot_name
}
</slot-name>
<file-names>PR.PRM61C70V1002.K010927.tar.gz</file-names>
</software-install>
"""
install_reply_xml
=
nc
.
custom_rpc_request
(
install_rpc_xml
)
if
install_reply_xml
:
install_data
=
xmltodict
.
parse
(
install_reply_xml
)
nc
.
software_output_json_logger
.
info
(
''
,
extra
=
{
'data'
:
install_data
})
break
except
Exception
as
e
:
except
Exception
as
e
:
nc
.
logger
.
debug
(
'Got exception, waiting 10 seconds before reconnecting...'
)
nc
.
logger
.
debug
(
'Got exception, waiting 10 seconds before reconnecting...'
)
nc
.
logger
.
debug
(
str
(
e
))
nc
.
logger
.
debug
(
str
(
e
))
...
...
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