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
520f7e80
Commit
520f7e80
authored
Aug 11, 2023
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/ors-amarisoft: software management WIP
parent
8244c24b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
3 deletions
+99
-3
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+1
-1
software/ors-amarisoft/instance-enb.jinja2.cfg
software/ors-amarisoft/instance-enb.jinja2.cfg
+18
-0
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
+78
-0
software/ors-amarisoft/netconf/software_install.jinja2.xml
software/ors-amarisoft/netconf/software_install.jinja2.xml
+2
-2
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
520f7e80
...
...
@@ -36,7 +36,7 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum =
3f7416ff8d012de487479e0372c515a3
md5sum =
a7186816e468937baafa211ca67984ee
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
...
...
software/ors-amarisoft/instance-enb.jinja2.cfg
View file @
520f7e80
...
...
@@ -11,6 +11,7 @@ parts =
lopcomm-firmware-dl
lopcomm-rrh-stats-service
lopcomm-rrh-config-template
lopcomm-rrh-software-template
lopcomm-cu-config
check-lopcomm-vswr.py
check-lopcomm-pa-current.py
...
...
@@ -269,6 +270,23 @@ mode = 0775
url = {{ lopcomm_rrh_config_template }}
output = ${directory:script}/lopcomm-rrh-config.py
[lopcomm-rrh-software-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-software.log
context =
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
key log_file :log-output
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw software_download {{ software_download_template }}
import netaddr netaddr
mode = 0775
url = {{ lopcomm_rrh_software_template }}
output = ${directory:script}/lopcomm-rrh-software.py
[amarisoft-stats-service]
recipe = slapos.cookbook:wrapper
command-line = ${amarisoft-stats-template:output}
...
...
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
0 → 100644
View file @
520f7e80
#!{{ python_path }}
import
logging
import
time
import
xmltodict
from
logging.handlers
import
RotatingFileHandler
from
ncclient
import
manager
from
ncclient.operations
import
RPCError
from
ncclient.xml_
import
*
from
ncclient.devices.default
import
DefaultDeviceHandler
class
LopcommNetconfClient
:
def
__init__
(
self
):
log_file
=
"{{ log_file }}"
self
.
logger
=
logging
.
getLogger
(
'logger'
)
self
.
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
)
if
{{
testing
}}:
return
def
connect
(
self
,
host
,
port
,
user
,
password
):
if
{{
testing
}}:
return
self
.
address
=
(
host
,
port
)
self
.
logger
.
info
(
'Connecting to %s, user %s...'
%
(
self
.
address
,
user
))
self
.
conn
=
manager
.
connect
(
host
=
host
,
port
=
port
,
username
=
user
,
password
=
password
,
timeout
=
1800
,
device_params
=
{
'name'
:
'default'
},
hostkey_verify
=
False
)
self
.
logger
.
info
(
'Connection to %s successful'
%
(
self
.
address
,))
def
edit_config
(
self
,
config_files
):
for
config_file
in
config_files
:
with
open
(
config_file
)
as
f
:
config_xml
=
f
.
read
()
try
:
self
.
logger
.
info
(
'Sending software management RPC request...'
)
self
.
conn
.
edit_config
(
target
=
'running'
,
config
=
config_xml
)
self
.
logger
.
info
(
'Software management RPC request sent successfully'
)
except
RPCError
as
e
:
self
.
logger
.
error
(
'Error sending software management RPC request: %s'
%
e
)
def
close
(
self
):
# Close not compatible between ncclient and netconf server
#self.conn.close()
pass
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
()
while
True
:
try
:
nc
.
connect
(
"{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
edit_config
([
"{{ CreateProcessingEle_template }}"
,
"{{ cu_config_template }}"
])
break
except
Exception
as
e
:
nc
.
logger
.
debug
(
'Got exception, waiting 10 seconds before reconnecting...'
)
nc
.
logger
.
debug
(
e
)
time
.
sleep
(
10
)
finally
:
nc
.
close
()
software/ors-amarisoft/netconf/software_install.jinja2.xml
View file @
520f7e80
<software-install
xmlns=
"urn:o-ran:software-management:1.0"
>
<slot-name>
slot-
1
</slot-name>
<file-names>
PR.PR
46Q1LNV1001.1.tar.gz
</file-names>
<slot-name>
slot-
2
</slot-name>
<file-names>
PR.PR
M61C70V1002.K010927.tar.g
</file-names>
</software-install>
\ No newline at end of file
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