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
Levin Zimmermann
slapos
Commits
fde5620b
Commit
fde5620b
authored
Aug 30, 2024
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/ors-amarisoft: remove lopcomm from SR
parent
c3244027
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
3 additions
and
1122 deletions
+3
-1122
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+3
-39
software/ors-amarisoft/cell/common.json
software/ors-amarisoft/cell/common.json
+0
-3
software/ors-amarisoft/instance.cfg
software/ors-amarisoft/instance.cfg
+0
-21
software/ors-amarisoft/ru/buildout.cfg
software/ors-amarisoft/ru/buildout.cfg
+0
-1
software/ors-amarisoft/ru/input-schema.json
software/ors-amarisoft/ru/input-schema.json
+0
-3
software/ors-amarisoft/ru/libinstance.jinja2.cfg
software/ors-amarisoft/ru/libinstance.jinja2.cfg
+0
-2
software/ors-amarisoft/ru/lopcomm/CreateProcessingEle.jinja2.xml
...e/ors-amarisoft/ru/lopcomm/CreateProcessingEle.jinja2.xml
+0
-11
software/ors-amarisoft/ru/lopcomm/buildout.cfg
software/ors-amarisoft/ru/lopcomm/buildout.cfg
+0
-39
software/ors-amarisoft/ru/lopcomm/config.jinja2.py
software/ors-amarisoft/ru/lopcomm/config.jinja2.py
+0
-19
software/ors-amarisoft/ru/lopcomm/cu_config.jinja2.xml
software/ors-amarisoft/ru/lopcomm/cu_config.jinja2.xml
+0
-132
software/ors-amarisoft/ru/lopcomm/input-schema.json
software/ors-amarisoft/ru/lopcomm/input-schema.json
+0
-64
software/ors-amarisoft/ru/lopcomm/libinstance.jinja2.cfg
software/ors-amarisoft/ru/lopcomm/libinstance.jinja2.cfg
+0
-314
software/ors-amarisoft/ru/lopcomm/ncclient_common.py
software/ors-amarisoft/ru/lopcomm/ncclient_common.py
+0
-222
software/ors-amarisoft/ru/lopcomm/reset-info.jinja2.py
software/ors-amarisoft/ru/lopcomm/reset-info.jinja2.py
+0
-39
software/ors-amarisoft/ru/lopcomm/reset.jinja2.py
software/ors-amarisoft/ru/lopcomm/reset.jinja2.py
+0
-17
software/ors-amarisoft/ru/lopcomm/software.jinja2.py
software/ors-amarisoft/ru/lopcomm/software.jinja2.py
+0
-104
software/ors-amarisoft/ru/lopcomm/stats.jinja2.py
software/ors-amarisoft/ru/lopcomm/stats.jinja2.py
+0
-81
software/ors-amarisoft/slaplte.jinja2
software/ors-amarisoft/slaplte.jinja2
+0
-11
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
fde5620b
...
...
@@ -16,7 +16,7 @@
[template]
filename = instance.cfg
md5sum =
2e30c07c6436895ac0bc6c177cf7013d
md5sum =
f096f3cbb414730a9f0d46b0c0f5eb22
[template-ors]
filename = instance-ors.cfg
...
...
@@ -24,7 +24,7 @@ md5sum = f5c76c3443b75569eb18503dce38e783
[slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2
md5sum =
871ade334f445e22d6cb473e4d4e3522
md5sum =
27c49897c9a3e4c260105534bed0132d
[ru_amarisoft-stats.jinja2.py]
_update_hash_filename_ = ru/amarisoft-stats.jinja2.py
...
...
@@ -36,44 +36,16 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883
[ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum =
2dda7713832be83d94522c7abb4901f9
md5sum =
7613c4decd4468ab5d826421aef955f1
[ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
md5sum = b7906ca3a6b17963f78f680fc0842b74
[ru_lopcomm_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/lopcomm/libinstance.jinja2.cfg
md5sum = c3bd882559ab9cd2a068519ea5d8c92e
[ru_sunwave_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sunwave/libinstance.jinja2.cfg
md5sum = bc5d82b8737b6990674b280ef2774be7
[ru_lopcomm_ncclient_common.py]
_update_hash_filename_ = ru/lopcomm/ncclient_common.py
md5sum = 8dbe6a48fc0fca4f0cbd0c746be1aeda
[ru_lopcomm_stats.jinja2.py]
_update_hash_filename_ = ru/lopcomm/stats.jinja2.py
md5sum = b7ec0025a92e0947e4ac6abc4b06bf19
[ru_lopcomm_config.jinja2.py]
_update_hash_filename_ = ru/lopcomm/config.jinja2.py
md5sum = 122726666d147447171dcae9ebf8d093
[ru_lopcomm_reset-info.jinja2.py]
_update_hash_filename_ = ru/lopcomm/reset-info.jinja2.py
md5sum = 3d78df1993211efaabd3dc6f2ec8de30
[ru_lopcomm_reset.jinja2.py]
_update_hash_filename_ = ru/lopcomm/reset.jinja2.py
md5sum = 9741fbc99aaf768e9cc3ab48925dfee5
[ru_lopcomm_software.jinja2.py]
_update_hash_filename_ = ru/lopcomm/software.jinja2.py
md5sum = 2b08bb666c5f3ab287cdddbfdb4c9249
[ru_tapsplit]
_update_hash_filename_ = ru/tapsplit
md5sum = 700aab566289619fb83ac6f3b085d983
...
...
@@ -150,14 +122,6 @@ md5sum = f07c85916bcb7e4002c8edc3d087c1be
filename = config/ue.jinja2.cfg
md5sum = 62291a11fd36a42464901cdc81338687
[ru_lopcomm_CreateProcessingEle.jinja2.xml]
_update_hash_filename_ = ru/lopcomm/CreateProcessingEle.jinja2.xml
md5sum = e435990eb0a0d4be41efa9bd16dce09b
[ru_lopcomm_cu_config.jinja2.xml]
_update_hash_filename_ = ru/lopcomm/cu_config.jinja2.xml
md5sum = 346c911e1ac5e5001a39c8926b44c91e
[software.cfg.html]
_update_hash_filename_ = gadget/software.cfg.html
md5sum = 61a2f783fbf683a34aed3d13e00baca2
...
...
software/ors-amarisoft/cell/common.json
View file @
fde5620b
...
...
@@ -105,9 +105,6 @@
{
"$ref"
:
"../ru/sdr/input-schema.json"
},
{
"$ref"
:
"../ru/lopcomm/input-schema.json"
},
{
"$ref"
:
"../ru/sunwave/input-schema.json"
}
...
...
software/ors-amarisoft/instance.cfg
View file @
fde5620b
...
...
@@ -46,7 +46,6 @@ import-list =
rawfile slaplte.jinja2 ${slaplte.jinja2:target}
rawfile ru_libinstance.jinja2.cfg ${ru_libinstance.jinja2.cfg:target}
rawfile ru_sdr_libinstance.jinja2.cfg ${ru_sdr_libinstance.jinja2.cfg:target}
rawfile ru_lopcomm_libinstance.jinja2.cfg ${ru_lopcomm_libinstance.jinja2.cfg:target}
rawfile ru_sunwave_libinstance.jinja2.cfg ${ru_sunwave_libinstance.jinja2.cfg:target}
# activate eggs and modules used in jinja2 templates
...
...
@@ -158,16 +157,6 @@ extra-context =
raw sib23_template ${sib23.jinja2.asn:target}
raw ru_amarisoft_stats_template ${ru_amarisoft-stats.jinja2.py:target}
raw ru_amarisoft_rf_info_template ${ru_amarisoft-rf-info.jinja2.py:target}
raw ru_lopcomm_stats_template ${ru_lopcomm_stats.jinja2.py:target}
raw ru_lopcomm_config_template ${ru_lopcomm_config.jinja2.py:target}
raw ru_lopcomm_software_template ${ru_lopcomm_software.jinja2.py:target}
raw ru_lopcomm_reset_info_template ${ru_lopcomm_reset-info.jinja2.py:target}
raw ru_lopcomm_reset_template ${ru_lopcomm_reset.jinja2.py:target}
raw ru_lopcomm_CreateProcessingEle_template ${ru_lopcomm_CreateProcessingEle.jinja2.xml:target}
raw ru_lopcomm_cu_config_template ${ru_lopcomm_cu_config.jinja2.xml:target}
raw ru_lopcomm_cu_inactive_config_template ${ru_lopcomm_cu_config.jinja2.xml:target}
raw ru_lopcomm_firmware_path ${ru_lopcomm_firmware-dl:target}
raw ru_lopcomm_firmware_filename ${ru_lopcomm_firmware-dl:filename}
raw ru_tapsplit ${ru_tapsplit:target}
raw netcapdo ${netcapdo:exe}
raw openssl_location ${openssl:location}
...
...
@@ -217,16 +206,6 @@ extra-context =
raw ru_amarisoft_stats_template ${ru_amarisoft-stats.jinja2.py:target}
raw ru_amarisoft_rf_info_template ${ru_amarisoft-rf-info.jinja2.py:target}
raw ru_lopcomm_stats_template ${ru_lopcomm_stats.jinja2.py:target}
raw ru_lopcomm_config_template ${ru_lopcomm_config.jinja2.py:target}
raw ru_lopcomm_software_template ${ru_lopcomm_software.jinja2.py:target}
raw ru_lopcomm_reset_info_template ${ru_lopcomm_reset-info.jinja2.py:target}
raw ru_lopcomm_reset_template ${ru_lopcomm_reset.jinja2.py:target}
raw ru_lopcomm_CreateProcessingEle_template ${ru_lopcomm_CreateProcessingEle.jinja2.xml:target}
raw ru_lopcomm_cu_config_template ${ru_lopcomm_cu_config.jinja2.xml:target}
raw ru_lopcomm_cu_inactive_config_template ${ru_lopcomm_cu_config.jinja2.xml:target}
raw ru_lopcomm_firmware_path ${ru_lopcomm_firmware-dl:target}
raw ru_lopcomm_firmware_filename ${ru_lopcomm_firmware-dl:filename}
raw ru_tapsplit ${ru_tapsplit:target}
raw netcapdo ${netcapdo:exe}
raw ru_dnsmasq_template ${ru_dnsmasq.jinja2.cfg:target}
...
...
software/ors-amarisoft/ru/buildout.cfg
View file @
fde5620b
...
...
@@ -3,7 +3,6 @@
[buildout]
extends =
sdr/buildout.cfg
lopcomm/buildout.cfg
sunwave/buildout.cfg
parts +=
...
...
software/ors-amarisoft/ru/input-schema.json
View file @
fde5620b
...
...
@@ -6,9 +6,6 @@
{
"$ref"
:
"sdr/input-schema.json"
},
{
"$ref"
:
"lopcomm/input-schema.json"
},
{
"$ref"
:
"sunwave/input-schema.json"
}
...
...
software/ors-amarisoft/ru/libinstance.jinja2.cfg
View file @
fde5620b
...
...
@@ -53,10 +53,8 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
{%- set jcell_ru_ref = slaplte.jcell_ru_ref %}
{%- set ierror = slaplte.ierror %}
{%- import 'ru_sdr_libinstance.jinja2.cfg' as rudrv_sdr with context %}
{%- import 'ru_lopcomm_libinstance.jinja2.cfg' as rudrv_lopcomm with context %}
{%- import 'ru_sunwave_libinstance.jinja2.cfg' as rudrv_sunwave with context %}
{%- set rudrv_dict = namespace(sdr=rudrv_sdr,
lopcomm=rudrv_lopcomm,
sunwave=rudrv_sunwave) %}
{%- set rudrv_init = {} %}
...
...
software/ors-amarisoft/ru/lopcomm/CreateProcessingEle.jinja2.xml
deleted
100644 → 0
View file @
c3244027
<config
xmlns=
"urn:ietf:params:xml:ns:netconf:base:1.0"
>
<processing-elements
xmlns=
"urn:o-ran:processing-element:1.0"
>
<transport-session-type>
CPRI-INTERFACE
</transport-session-type>
<ru-elements>
<name>
PE0
</name>
<transport-flow>
<interface-name>
eth1
</interface-name>
</transport-flow>
</ru-elements>
</processing-elements>
</config>
\ No newline at end of file
software/ors-amarisoft/ru/lopcomm/buildout.cfg
deleted
100644 → 0
View file @
c3244027
# ru/lopcomm/buildout.cfg provides software code for handling Lopcomm ORAN Radio Units.
[buildout]
parts +=
ru_lopcomm_ncclient_common.py
[ru_lopcomm_libinstance.jinja2.cfg]
<= download-base
[ru_lopcomm_config.jinja2.py]
<= download-base
[ru_lopcomm_reset-info.jinja2.py]
<= download-base
[ru_lopcomm_reset.jinja2.py]
<= download-base
[ru_lopcomm_stats.jinja2.py]
<= download-base
[ru_lopcomm_software.jinja2.py]
<= download-base
[ru_lopcomm_ncclient_common.py]
<= download-base
destination = ${buildout:directory}/ncclient_common.py
[ru_lopcomm_CreateProcessingEle.jinja2.xml]
<= download-base
[ru_lopcomm_cu_config.jinja2.xml]
<= download-base
[ru_lopcomm_firmware-dl]
recipe = slapos.recipe.build:download
url = https://lab.nexedi.com/nexedi/ors-utils/raw/master/lopcomm-firmware/${:filename}
filename = PR.PRM61C70V1005.005.tar.gz
md5sum = 62281d0be42feac94e843e1850ba6e09
software/ors-amarisoft/ru/lopcomm/config.jinja2.py
deleted
100644 → 0
View file @
c3244027
#!{{ python_path }}
import
time
import
sys
sys
.
path
.
append
({{
repr
(
buildout_directory_path
)
}})
from
ncclient_common
import
LopcommNetconfClient
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
(
log_file
=
"{{ log_file }}"
)
while
True
:
try
:
nc
.
connect
(
"{{ netaddr.IPAddress(vtap.gateway) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
edit_config
([
"{{ CreateProcessingEle_template }}"
,
"{{ cu_inactive_config_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/ru/lopcomm/cu_config.jinja2.xml
deleted
100644 → 0
View file @
c3244027
<xc:config
xmlns:xc=
"urn:ietf:params:xml:ns:netconf:base:1.0"
>
<user-plane-configuration
xc:operation=
"replace"
xmlns=
"urn:o-ran:uplane-conf-option8:1.0"
>
<!-- TX path: eaxcid → TxEndpoint
↘
mod → static TxEndpoint → TxArray
↗
TxCarrier
(static TxEndpoint, TxArray and their association are defined by RU itself)
-->
{%- set TxCarrier = 'TXA0CC00' %}
{%- for ant in range(ru.n_antenna_dl) %}
{%- set port = ant // 2 %}
{%- set chan = ant % 2 %}
{%- set txep = 'TXA0P%02dC%02d' % (port, chan) %}
<!-- TxAntenna{{ ant }} -->
<tx-endpoints>
<name>
{{ txep }}
</name>
<e-axcid>
<o-du-port-bitmask>
61440
</o-du-port-bitmask>
<band-sector-bitmask>
3968
</band-sector-bitmask>
<ccid-bitmask>
112
</ccid-bitmask>
<ru-port-bitmask>
15
</ru-port-bitmask>
<eaxc-id>
{{ ant }}
</eaxc-id>
</e-axcid>
</tx-endpoints>
<tx-links>
<name>
{{ txep }}
</name>
<processing-element>
PE0
</processing-element>
<tx-array-carrier>
{{ TxCarrier }}
</tx-array-carrier>
<tx-endpoint>
{{ txep }}
</tx-endpoint>
</tx-links>
{%- endfor %}
<!--
RX path: eaxcid ← RxEndpoint
(data ∪ prach)
↖
demod ← static RxEndpoint ← RxArray
↗
RxCarrier
(static RxEndpoint, RxArray and their association are defined by RU itself)
-->
{%- set RxCarrier = 'RXA0CC00' %}
{%- for ant in range(ru.n_antenna_ul) %}
{%- set port = ant // 2 %}
{%- set chan = ant % 2 %}
{%- set rxep = 'RXA0P%02dC%02d' % (port, chan) %}
{%- set prachep = 'PRACH0P%02dC%02d' % (port, chan) %}
<!-- RxAntenna{{ ant }} -->
<rx-endpoints>
<name>
{{ rxep }}
</name>
<e-axcid>
<o-du-port-bitmask>
61440
</o-du-port-bitmask>
<band-sector-bitmask>
3968
</band-sector-bitmask>
<ccid-bitmask>
112
</ccid-bitmask>
<ru-port-bitmask>
15
</ru-port-bitmask>
<eaxc-id>
{{ ant }}
</eaxc-id>
</e-axcid>
</rx-endpoints>
<rx-endpoints>
<name>
{{ prachep }}
</name>
<e-axcid>
<o-du-port-bitmask>
61440
</o-du-port-bitmask>
<band-sector-bitmask>
3968
</band-sector-bitmask>
<ccid-bitmask>
112
</ccid-bitmask>
<ru-port-bitmask>
15
</ru-port-bitmask>
<eaxc-id>
{{ 16*chan + 8 + port }}
</eaxc-id>
</e-axcid>
</rx-endpoints>
<rx-links>
<name>
{{ rxep }}
</name>
<processing-element>
PE0
</processing-element>
<rx-array-carrier>
{{ RxCarrier }}
</rx-array-carrier>
<rx-endpoint>
{{ rxep }}
</rx-endpoint>
</rx-links>
<rx-links>
<name>
{{ prachep }}
</name>
<processing-element>
PE0
</processing-element>
<rx-array-carrier>
{{ RxCarrier }}
</rx-array-carrier>
<rx-endpoint>
{{ prachep }}
</rx-endpoint>
</rx-links>
{%- endfor %}
<!-- TX/RX carriers -->
<!-- TODO support multiple cells over 1 RU -->
{%- if cell.cell_type == 'lte' %}
{%- set dl_arfcn = cell.dl_earfcn %}
{%- set ul_arfcn = cell.ul_earfcn %}
{%- set dl_freq = int(xearfcn_module.frequency(dl_arfcn) * 1e6) %}
{%- set ul_freq = int(xearfcn_module.frequency(ul_arfcn) * 1e6) %}
{%- elif cell.cell_type == 'nr' %}
{%- set dl_arfcn = cell.dl_nr_arfcn %}
{%- set ul_arfcn = cell.ul_nr_arfcn %}
{%- set dl_freq = int(xnrarfcn_module.frequency(dl_arfcn) * 1e6) %}
{%- set ul_freq = int(xnrarfcn_module.frequency(ul_arfcn) * 1e6) %}
{%- else %}
{%- do bug('unreachable') %}
{%- endif %}
{%- set bw = int(cell.bandwidth * 1e6) %}
<tx-array-carriers>
<name>
{{ TxCarrier }}
</name>
<absolute-frequency-center>
{{ dl_arfcn }}
</absolute-frequency-center>
<center-of-channel-bandwidth>
{{ dl_freq }}
</center-of-channel-bandwidth>
<channel-bandwidth>
{{ bw }}
</channel-bandwidth>
<active>
{{ ru.txrx_active }}
</active>
<rw-type>
{{ cell.cell_type | upper }}
</rw-type>
<rw-duplex-scheme>
{{ cell.rf_mode | upper }}
</rw-duplex-scheme>
<gain>
{{ ru.tx_gain }}
</gain>
<downlink-radio-frame-offset>
0
</downlink-radio-frame-offset>
<downlink-sfn-offset>
0
</downlink-sfn-offset>
</tx-array-carriers>
<rx-array-carriers>
<name>
{{ RxCarrier }}
</name>
<absolute-frequency-center>
{{ ul_arfcn }}
</absolute-frequency-center>
<center-of-channel-bandwidth>
{{ ul_freq }}
</center-of-channel-bandwidth>
<channel-bandwidth>
{{ bw }}
</channel-bandwidth>
<active>
{{ ru.txrx_active }}
</active>
<downlink-radio-frame-offset>
0
</downlink-radio-frame-offset>
<downlink-sfn-offset>
0
</downlink-sfn-offset>
<!-- <gain>{{ ru.rx_gain }}</gain> -->
<!-- TODO(lu.xu): clarify with Lopcomm regaring rx gain -->
<gain-correction>
0.0
</gain-correction>
<n-ta-offset>
0
</n-ta-offset>
</rx-array-carriers>
</user-plane-configuration>
</xc:config>
software/ors-amarisoft/ru/lopcomm/input-schema.json
deleted
100644 → 0
View file @
c3244027
{
"$schema"
:
"https://json-schema.org/draft/2020-12/schema"
,
"title"
:
"Lopcomm ORAN"
,
"type"
:
"object"
,
"required"
:
[
"ru_type"
,
"ru_link_type"
,
"n_antenna_dl"
,
"n_antenna_ul"
,
"tx_gain"
,
"rx_gain"
,
"cpri_link"
,
"mac_addr"
],
"properties"
:
{
"$ref"
:
"../../ru/common.json#/properties"
,
"ru_type"
:
{
"$ref"
:
"#/properties/ru_type"
,
"const"
:
"lopcomm"
},
"ru_link_type"
:
{
"$ref"
:
"#/properties/ru_link_type"
,
"const"
:
"cpri"
},
"n_antenna_dl"
:
{
"$ref"
:
"#/properties/n_antenna_dl"
,
"default"
:
2
},
"n_antenna_ul"
:
{
"$ref"
:
"#/properties/n_antenna_ul"
,
"default"
:
2
},
"cpri_link"
:
{
"$ref"
:
"#/properties/cpri_link"
,
"properties"
:
{
"$ref"
:
"#/properties/cpri_link/properties"
,
"mapping"
:
{
"$ref"
:
"#/properties/cpri_link/properties/mapping"
,
"const"
:
"hw"
,
"enum"
:
[
"hw"
]
},
"rx_delay"
:
{
"$ref"
:
"#/properties/cpri_link/properties/rx_delay"
,
"default"
:
25.11
},
"tx_delay"
:
{
"$ref"
:
"#/properties/cpri_link/properties/tx_delay"
,
"default"
:
14.71
},
"tx_dbm"
:
{
"$ref"
:
"#/properties/cpri_link/properties/tx_dbm"
,
"default"
:
63
}
}
},
"reset_schedule"
:
{
"title"
:
"Cron schedule for RRH reset"
,
"description"
:
"Refer https://crontab.guru/ to make a reset schedule for RRH, for example, '0 1 * * *' means the RRH will reset every day at 1 am"
,
"type"
:
"string"
}
}
}
software/ors-amarisoft/ru/lopcomm/libinstance.jinja2.cfg
deleted
100644 → 0
View file @
c3244027
{#- Package ru/lopcomm/libinstance provides instance code for handling Lopcomm ORAN Radio Units. #}
{%- macro buildout_iru(iru, icell_list) %}
{%- set ru_ref = J(jref_of_shared(iru)) %}
{%- set ru = iru['_'] %}
{%- set ns = namespace(inactive_ru=ru.copy()) %}
{%- do ns.inactive_ru.update({'txrx_active': 'INACTIVE'}) %}
{%- if len(icell_list) != 1 %}
{%- do ierror(iru, 'ru/lopcomm supports only 1 cell ; requested %d' % len(icell_list)) %}
{%- endif %}
{%- set icell = icell_list[0] %}
{%- set cell = icell['_'] %}
{#- indicate whether RU is listening for netconf #}
{%- if not testing %}
{{ promise('%s-netconf-socket' % ru_ref) }}
promise = check_socket_listening
config-host = ${vtap.{{ru.cpri_link._tap}}:gateway}
config-port = 830
{%- endif %}
{#- push firmware to RU #}
{{ part('%s-software-template' % ru_ref) }}
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
_logbase = ${directory:var}/log/{{B('%s-software' % ru_ref)}}
log-output = ${:_logbase}.log
software-reply-json-log-output = ${:_logbase}-reply.json.log
remote-file-path = sftp://${user-info:pw-name}@[${sshd-service:ipv6}]:${sshd-service:port}{{ru_lopcomm_firmware_path}}
is_firmware_updated = ${directory:etc}/{{B('%s.is_firmware_updated' % ru_ref)}}
context =
section directory directory
section vtap vtap.{{ ru.cpri_link._tap }}
key slapparameter_dict myslap:parameter_dict
key log_file :log-output
key software_reply_json_log_file :software-reply-json-log-output
key remote_file_path :remote-file-path
raw testing {{ testing }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
key is_firmware_updated :is_firmware_updated
raw firmware_name {{ru_lopcomm_firmware_filename}}
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_software_template }}
output = ${directory:script}/{{B('%s-software.py' % ru_ref)}}
{%- if not testing %}
{{ promise('%s-firmware' % ru_ref) }}
promise = check_command_execute
config-command = [ -f ${ {{-B('%s-software-template' % ru_ref)}}:is_firmware_updated} ]
{%- endif %}
[{{ B('%s-cu-config' % ru_ref) }}]
<= config-base
url = {{ ru_lopcomm_cu_config_template }}
output = ${directory:etc}/{{B('%s-cu_config.xml' % ru_ref)}}
extra-context =
import xearfcn_module xlte.earfcn
import xnrarfcn_module xlte.nrarfcn
key ru :ru
key cell :cell
ru = {{ dumps(ru) }}
cell = {{ dumps(cell) }}
[{{ B('%s-cu-inactive-config' % ru_ref) }}]
<= config-base
url = {{ ru_lopcomm_cu_config_template }}
output = ${directory:etc}/{{B('%s-cu_inactive_config.xml' % ru_ref)}}
extra-context =
import xearfcn_module xlte.earfcn
import xnrarfcn_module xlte.nrarfcn
key ru :ru
key cell :cell
ru = {{ dumps(ns.inactive_ru) }}
cell = {{ dumps(cell) }}
[{{ B('%s-config-template' % ru_ref) }}]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/{{B('%s-config.log' % ru_ref)}}
context =
section directory directory
section vtap vtap.{{ ru.cpri_link._tap }}
key log_file :log-output
raw testing {{ testing }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
raw CreateProcessingEle_template {{ ru_lopcomm_CreateProcessingEle_template }}
key cu_config_template {{B('%s-cu-config' % ru_ref)}}:output
key cu_inactive_config_template {{B('%s-cu-inactive-config' % ru_ref)}}:output
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_config_template }}
output = ${directory:script}/{{B('%s-config.py' % ru_ref)}}
{{ promise('%s-config-log' % ru_ref) }}
promise = check_lopcomm_config_log
config-config-log = ${ {{-B('%s-config-template' % ru_ref)}}:log-output}
{#- handle notifications from RU + keep on touching RU watchdog #}
[{{ B('%s-stats-template' % ru_ref) }}]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
_logbase = ${directory:var}/log/{{B('%s' % ru_ref)}}
log-output = ${:_logbase}-stats.log
json-log-output = ${:_logbase}-stats.json.log
cfg-json-log-output = ${:_logbase}-config.json.log
supervision-json-log-output = ${:_logbase}-supervision.json.log
ncsession-json-log-output = ${:_logbase}-ncsession.json.log
software-json-log-output = ${:_logbase}-software.json.log
supervision-reply-json-log-output = ${:_logbase}-supervision-reply.json.log
is_netconf_connected = ${directory:etc}/{{B('%s.is_netconf_connected' % ru_ref)}}
context =
section directory directory
section vtap vtap.{{ ru.cpri_link._tap }}
key slapparameter_dict myslap:parameter_dict
key log_file :log-output
key json_log_file :json-log-output
key cfg_json_log_file :cfg-json-log-output
key supervision_json_log_file :supervision-json-log-output
key supervision_reply_json_log_file :supervision-reply-json-log-output
key is_netconf_connected :is_netconf_connected
key ncsession_json_log_file :ncsession-json-log-output
key software_json_log_file :software-json-log-output
raw testing {{ testing }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_stats_template }}
output = ${directory:bin}/{{B('%s-stats.py' % ru_ref)}}
{{ part('%s-stats-service' % ru_ref) }}
recipe = slapos.cookbook:wrapper
command-line = ${ {{-B('%s-stats-template' % ru_ref)}}:output}
wrapper-path = ${directory:service}/{{B('%s-stats' % ru_ref)}}
mode = 0775
hash-files =
${:command-line}
{%- if not testing %}
{{ promise('%s-netconf-connection' % ru_ref) }}
promise = check_command_execute
config-command = [ -f ${ {{-B('%s-stats-template' % ru_ref)}}:is_netconf_connected} ]
{%- endif %}
{{ promise('%s-vswr' % ru_ref) }}
promise = check_lopcomm_vswr
config-netconf-log = ${ {{-B('%s-stats-template' % ru_ref)}}:json-log-output}
{{ promise('%s-rssi' % ru_ref) }}
promise = check_lopcomm_rssi
config-netconf-log = ${ {{-B('%s-stats-template' % ru_ref)}}:json-log-output}
{{ promise('%s-pa-current' % ru_ref) }}
promise = check_lopcomm_pa_current
config-netconf-log = ${ {{-B('%s-stats-template' % ru_ref)}}:json-log-output}
{{ promise('%s-pa-output-power' % ru_ref) }}
promise = check_lopcomm_pa_output_power
config-netconf-log = ${ {{-B('%s-stats-template' % ru_ref)}}:json-log-output}
{{ promise('%s-sync' % ru_ref) }}
promise = check_lopcomm_sync
config-netconf-log = ${ {{-B('%s-stats-template' % ru_ref)}}:json-log-output}
{{ promise('%s-lof' % ru_ref) }}
promise = check_lopcomm_lof
config-netconf-log = ${ {{-B('%s-stats-template' % ru_ref)}}:json-log-output}
{{ promise('%s-stats-log' % ru_ref) }}
promise = check_lopcomm_stats_log
config-stats-log = ${ {{-B('%s-stats-template' % ru_ref)}}:log-output}
{#- reset RU periodically #}
{%- if ru.get("reset_schedule") %}
[{{ B('%s-reset-info-template' % ru_ref) }}]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
_logbase = ${directory:var}/log/{{B('%s-reset-info' % ru_ref)}}
log-output = ${:_logbase}.log
json-log-output = ${:_logbase}.json.log
context =
section vtap vtap.{{ ru.cpri_link._tap }}
key log_file :log-output
key json_log_file :json-log-output
raw stats_period {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
raw testing {{ testing }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_reset_info_template }}
output = ${directory:bin}/{{B('%s-reset-info.py' % ru_ref)}}
[{{ B('%s-reset-template' % ru_ref) }}]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
_logbase = ${directory:var}/log/{{B('%s-reset' % ru_ref)}}
log-output = ${:_logbase}.log
json-log-output = ${:_logbase}.json.log
context =
section vtap vtap.{{ ru.cpri_link._tap }}
key log_file :log-output
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_reset_template }}
output = ${directory:etc}/{{B('%s-reset.py' % ru_ref)}}
{{ part('%s-reset-cron' % ru_ref) }}
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = {{B('%s-reset' % ru_ref)}}
frequency = {{ ru.reset_schedule }}
command = {{ buildout_directory}}/bin/pythonwitheggs ${ {{-B('%s-reset-template' % ru_ref)}}:output}
{{ part('%s-reset-info-service' % ru_ref) }}
recipe = slapos.cookbook:wrapper
command-line = ${ {{-B('%s-reset-info-template' % ru_ref)}}:output}
wrapper-path = ${directory:service}/{{B('%s-reset-info' % ru_ref)}}
mode = 0775
hash-files =
${:command-line}
{%- endif %}
{#- amend RU-published information with Lopcomm-specific bits #}
[{{ B('ipublish-%s' % ru_ref) }}]
bbu-ssh-command = ssh ${user-info:pw-name}@${sshd-service:ipv6} -p ${sshd-service:port}
bbu-ssh-url = ssh://${user-info:pw-name}@[${sshd-service:ipv6}]:${sshd-service:port}
firmware = {{ru_lopcomm_firmware_filename}}
{%- endmacro %}
{%- macro buildout() %}
# deploy openssh-server for software upgrade
#
# FIXME user-authorized-key is global for eNB. Either we need to put SSH server
# to be also global, or unroll an SSH server via paramiko inside
# ru/lopcomm/software.py just to handle software upgrades there.
[user-info]
recipe = slapos.cookbook:userinfo
[sshd-port]
recipe = slapos.cookbook:free_port
minimum = 22222
maximum = 22231
ip = {{my_ipv6}}
[sshd-config]
recipe = slapos.recipe.template:jinja2
output = ${directory:etc}/sshd.conf
path_pid = ${directory:run}/sshd.pid
inline =
PidFile ${:path_pid}
Port ${sshd-port:port}
ListenAddress ${sshd-port:ip}
Protocol 2
HostKey ${sshd-ssh-host-rsa-key:output}
HostKey ${sshd-ssh-host-ecdsa-key:output}
PasswordAuthentication no
PubkeyAuthentication yes
HostKeyAlgorithms ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp521
AuthorizedKeysFile ${buildout:directory}/.ssh/authorized_keys
Subsystem sftp {{ openssh_location }}/libexec/sftp-server
{{ part('sshd-service') }}
recipe = slapos.cookbook:wrapper
command-line = {{ openssh_location }}/sbin/sshd -D -e -f ${sshd-config:output}
wrapper-path = ${directory:service}/sshd
hash-files = ${sshd-config:output}
environment =
HOME=${directory:home}
ipv6 = ${sshd-port:ip}
port = ${sshd-port:port}
{{ part('sshd-add-authorized-key') }}
recipe = slapos.cookbook:dropbear.add_authorized_key
home = ${buildout:directory}
key = {{ slapparameter_dict.get("user-authorized-key", '') }}
[sshd-ssh-keygen-base]
recipe = plone.recipe.command
output = ${directory:etc}/${:_buildout_section_name_}
command = {{ openssh_output_keygen }} -f ${:output} -N '' ${:extra-args}
[sshd-ssh-host-rsa-key]
<=sshd-ssh-keygen-base
extra-args=-t rsa
[sshd-ssh-host-ecdsa-key]
<=sshd-ssh-keygen-base
extra-args=-t ecdsa -b 521
{{ promise('sshd') }}
promise = check_socket_listening
config-host = ${sshd-service:ipv6}
config-port = ${sshd-service:port}
{%- endmacro %}
software/ors-amarisoft/ru/lopcomm/ncclient_common.py
deleted
100644 → 0
View file @
c3244027
import
time
import
logging
import
json
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
,
json_log_file
=
None
,
cfg_json_log_file
=
None
,
supervision_json_log_file
=
None
,
ncsession_json_log_file
=
None
,
software_json_log_file
=
None
,
software_reply_json_log_file
=
None
,
supervision_reply_json_log_file
=
None
,
testing
=
False
):
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
json_log_file
:
self
.
json_logger
=
logging
.
getLogger
(
'json_logger'
)
self
.
json_logger
.
setLevel
(
logging
.
DEBUG
)
json_handler
=
RotatingFileHandler
(
json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
json_handler
.
setFormatter
(
json_formatter
)
self
.
json_logger
.
addHandler
(
json_handler
)
self
.
cfg_json_logger
=
logging
.
getLogger
(
'cfg_json_logger'
)
self
.
cfg_json_logger
.
setLevel
(
logging
.
DEBUG
)
cfg_json_handler
=
RotatingFileHandler
(
cfg_json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
cfg_json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
cfg_json_handler
.
setFormatter
(
cfg_json_formatter
)
self
.
cfg_json_logger
.
addHandler
(
cfg_json_handler
)
self
.
supervision_json_logger
=
logging
.
getLogger
(
'supervision_json_logger'
)
self
.
supervision_json_logger
.
setLevel
(
logging
.
DEBUG
)
supervision_json_handler
=
RotatingFileHandler
(
supervision_json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
supervision_json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
supervision_json_handler
.
setFormatter
(
supervision_json_formatter
)
self
.
supervision_json_logger
.
addHandler
(
supervision_json_handler
)
self
.
ncsession_json_logger
=
logging
.
getLogger
(
'ncsession_json_logger'
)
self
.
ncsession_json_logger
.
setLevel
(
logging
.
DEBUG
)
ncsession_json_handler
=
RotatingFileHandler
(
ncsession_json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
ncsession_json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
ncsession_json_handler
.
setFormatter
(
ncsession_json_formatter
)
self
.
ncsession_json_logger
.
addHandler
(
ncsession_json_handler
)
self
.
software_json_logger
=
logging
.
getLogger
(
'software_json_logger'
)
self
.
software_json_logger
.
setLevel
(
logging
.
DEBUG
)
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
)
else
:
self
.
json_logger
=
None
self
.
cfg_json_logger
=
None
self
.
supervision_json_logger
=
None
self
.
ncsession_json_logger
=
None
self
.
software_json_logger
=
None
if
supervision_reply_json_log_file
:
self
.
supervision_reply_json_logger
=
logging
.
getLogger
(
'supervision_reply_json_logger'
)
self
.
supervision_reply_json_logger
.
setLevel
(
logging
.
DEBUG
)
supervision_reply_json_handler
=
RotatingFileHandler
(
supervision_reply_json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
supervision_reply_json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
supervision_reply_json_handler
.
setFormatter
(
supervision_reply_json_formatter
)
self
.
supervision_reply_json_logger
.
addHandler
(
supervision_reply_json_handler
)
else
:
self
.
supervision_reply_json_logger
=
None
if
software_reply_json_log_file
:
self
.
software_reply_json_logger
=
logging
.
getLogger
(
'software_reply_json_logger'
)
self
.
software_reply_json_logger
.
setLevel
(
logging
.
DEBUG
)
software_reply_json_handler
=
RotatingFileHandler
(
software_reply_json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
software_reply_json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
software_reply_json_handler
.
setFormatter
(
software_reply_json_formatter
)
self
.
software_reply_json_logger
.
addHandler
(
software_reply_json_handler
)
else
:
self
.
software_reply_json_logger
=
None
if
testing
:
return
def
connect
(
self
,
host
,
port
,
user
,
password
):
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
subscribe
(
self
):
sub
=
self
.
conn
.
create_subscription
()
self
.
logger
.
info
(
'Subscription to %s successful'
%
(
self
.
address
,))
def
get_notification
(
self
):
self
.
logger
.
debug
(
'Waiting for notification from %s...'
%
(
self
.
address
,))
result
=
self
.
conn
.
take_notification
(
block
=
True
,
timeout
=
120
)
if
result
:
self
.
logger
.
debug
(
'Got new notification from %s...'
%
(
self
.
address
,))
result_in_xml
=
result
.
_raw
data_dict
=
xmltodict
.
parse
(
result_in_xml
)
if
'alarm-notif'
in
data_dict
[
'notification'
]:
self
.
json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
data_dict
)})
elif
'supervision-notification'
in
data_dict
[
'notification'
]:
self
.
supervision_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
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'
:
json
.
dumps
(
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'
:
json
.
dumps
(
data_dict
)})
else
:
self
.
cfg_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
data_dict
)})
else
:
raise
TimeoutError
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 edit-config RPC request...'
)
self
.
conn
.
edit_config
(
target
=
'running'
,
config
=
config_xml
)
self
.
logger
.
info
(
'Edit-config RPC request sent successfully'
)
except
RPCError
as
e
:
self
.
logger
.
error
(
'Error sending edit-config RPC request: %s'
%
e
)
def
custom_rpc_request
(
self
,
rpc_xml
):
try
:
self
.
logger
.
info
(
'Sending custom RPC request...'
)
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
:
self
.
logger
.
error
(
'Error sending custom RPC request: %s'
%
e
)
def
reset_device
(
self
):
self
.
logger
.
info
(
'Resetting...'
)
reset_rpc_xml
=
"""
<reset xmlns="urn:o-ran:operations:1.0">
</reset>
"""
reset_reply_xml
=
self
.
custom_rpc_request
(
reset_rpc_xml
)
if
reset_reply_xml
:
reset_data
=
xmltodict
.
parse
(
reset_reply_xml
)
if
self
.
software_reply_json_logger
:
self
.
software_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
reset_data
)})
self
.
logger
.
info
(
'Wait 60 second then reboot!'
)
time
.
sleep
(
60
)
def
get_inventory
(
self
):
self
.
logger
.
info
(
'Fetching software inventory...'
)
inventory_rpc_xml
=
"""
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter type="subtree">
<software-inventory xmlns="urn:o-ran:software-management:1.0" />
</filter>
</get>
"""
inventory_reply_xml
=
self
.
custom_rpc_request
(
inventory_rpc_xml
)
if
inventory_reply_xml
:
self
.
logger
.
info
(
'Finish fetching software inventory.'
)
inventory_data
=
xmltodict
.
parse
(
inventory_reply_xml
)
self
.
software_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
inventory_data
)})
nonrunning_slot_name
=
None
running_slot_name
=
None
active_nonrunning_slot_name
=
None
nonrunning_slot_name_build_version
=
None
running_slot_name_build_version
=
None
software_slots
=
inventory_data
[
'nc:rpc-reply'
][
'data'
][
'software-inventory'
][
'software-slot'
]
for
slot
in
software_slots
:
if
slot
[
'running'
]
==
'false'
:
nonrunning_slot_name
=
slot
[
'name'
]
nonrunning_slot_name_build_version
=
slot
[
'build-version'
]
if
slot
[
'running'
]
==
'true'
:
running_slot_name
=
slot
[
'name'
]
running_slot_name_build_version
=
slot
[
'build-version'
]
elif
slot
[
'active'
]
==
'true'
and
slot
[
'running'
]
==
'false'
:
active_nonrunning_slot_name
=
slot
[
'name'
]
return
{
"nonrunning_slot_name"
:
nonrunning_slot_name
,
"running_slot_name"
:
running_slot_name
,
"active_nonrunning_slot_name"
:
active_nonrunning_slot_name
,
"nonrunning_slot_name_build_version"
:
nonrunning_slot_name_build_version
,
"running_slot_name_build_version"
:
running_slot_name_build_version
}
def
supervision_reset
(
self
,
interval
=
60
,
margin
=
10
):
self
.
logger
.
info
(
"NETCONF server supervision replying..."
)
supervision_watchdog_rpc_xml
=
f"""
<supervision-watchdog-reset xmlns="urn:o-ran:supervision:1.0">
<supervision-notification-interval>
{
interval
}
</supervision-notification-interval>
<guard-timer-overhead>
{
margin
}
</guard-timer-overhead>
</supervision-watchdog-reset>
"""
supervision_watchdog_reply_xml
=
self
.
custom_rpc_request
(
supervision_watchdog_rpc_xml
)
replied
=
False
if
supervision_watchdog_reply_xml
:
replied
=
True
self
.
logger
.
info
(
"NETCONF server supervision replied"
)
supervision_watchdog_data
=
xmltodict
.
parse
(
supervision_watchdog_reply_xml
)
self
.
supervision_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
supervision_watchdog_data
)})
return
replied
def
close
(
self
):
# Close not compatible between ncclient and netconf server
#self.conn.close()
pass
software/ors-amarisoft/ru/lopcomm/reset-info.jinja2.py
deleted
100644 → 0
View file @
c3244027
#!{{ python_path }}
import
paramiko
import
logging
from
logging.handlers
import
RotatingFileHandler
def
get_uptime
(
hostname
,
username
,
password
):
client
=
paramiko
.
SSHClient
()
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
try
:
client
.
connect
(
hostname
,
username
=
username
,
password
=
password
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
'uptime'
)
uptime_output
=
stdout
.
read
().
decode
()
return
uptime_output
except
Exception
as
e
:
logger
.
info
(
f"Error:
{
e
}
"
)
finally
:
client
.
close
()
# Usage
hostname
=
"{{ netaddr.IPAddress(vtap.gateway) }}"
username
=
"oranuser"
password
=
"oranpassword"
# Initialize logger
log_file
=
"{{ log_file }}"
logger
=
logging
.
getLogger
(
'logger'
)
logger
.
setLevel
(
logging
.
INFO
)
handler
=
RotatingFileHandler
(
log_file
,
maxBytes
=
30000
,
backupCount
=
2
)
formatter
=
logging
.
Formatter
(
'%(asctime)s - %(levelname)s - %(message)s'
)
handler
.
setFormatter
(
formatter
)
logger
.
addHandler
(
handler
)
if
{{
testing
}}:
pass
else
:
rrh_uptime
=
get_uptime
(
hostname
,
username
,
password
)
logger
.
info
(
f"Uptime from RRH:
{
rrh_uptime
}
"
)
software/ors-amarisoft/ru/lopcomm/reset.jinja2.py
deleted
100644 → 0
View file @
c3244027
#!{{ python_path }}
import
time
import
sys
sys
.
path
.
append
({{
repr
(
buildout_directory_path
)
}})
from
ncclient_common
import
LopcommNetconfClient
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
(
log_file
=
"{{ log_file }}"
)
try
:
nc
.
connect
(
"{{ netaddr.IPAddress(vtap.gateway) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
reset_device
()
nc
.
logger
.
info
(
"Device reset successful."
)
except
Exception
as
e
:
nc
.
logger
.
debug
(
'Got exception while resetting...'
)
nc
.
logger
.
debug
(
e
)
finally
:
nc
.
close
()
software/ors-amarisoft/ru/lopcomm/software.jinja2.py
deleted
100644 → 0
View file @
c3244027
#!{{ python_path }}
import
time
import
json
import
xmltodict
import
sys
import
re
import
os
sys
.
path
.
append
({{
repr
(
buildout_directory_path
)
}})
from
ncclient_common
import
LopcommNetconfClient
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
(
log_file
=
"{{ log_file }}"
,
software_reply_json_log_file
=
"{{ software_reply_json_log_file }}"
)
while
True
:
try
:
firmware_check_file
=
'{{ is_firmware_updated }}'
nc
.
connect
(
"{{ netaddr.IPAddress(vtap.gateway) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
# Fetch software inventory
inventory_vars
=
nc
.
get_inventory
()
nonrunning_slot_name
=
inventory_vars
[
"nonrunning_slot_name"
]
running_slot_name
=
inventory_vars
[
"running_slot_name"
]
active_nonrunning_slot_name
=
inventory_vars
[
"active_nonrunning_slot_name"
]
nonrunning_slot_name_build_version
=
inventory_vars
[
"nonrunning_slot_name_build_version"
]
running_slot_name_build_version
=
inventory_vars
[
"running_slot_name_build_version"
]
if
running_slot_name
and
nonrunning_slot_name
:
if
running_slot_name
:
nc
.
logger
.
info
(
"One slot is running and one is non-running. Proceeding..."
)
if
running_slot_name_build_version
in
"{{firmware_name}}"
:
if
not
os
.
path
.
exists
(
firmware_check_file
):
open
(
firmware_check_file
,
"w"
).
write
(
'True'
)
nc
.
logger
.
info
(
"Running slot's build-version %s is already updated. Skipping install."
%
running_slot_name_build_version
)
else
:
if
os
.
path
.
exists
(
firmware_check_file
):
os
.
remove
(
firmware_check_file
)
nc
.
logger
.
info
(
"Current build version: %s"
%
running_slot_name_build_version
)
user_authorized_key
=
"""{{ slapparameter_dict.get('user-authorized-key', '') }}"""
match
=
re
.
match
(
r'ssh-rsa ([^\
s]+)
', user_authorized_key)
if match:
extracted_key = match.group(1)
else:
nc.logger.info("No valid key found in user authorized key.")
download_rpc_xml = f"""
<software-download xmlns="urn:o-ran:software-management:1.0">
<remote-file-path>{{remote_file_path}}</remote-file-path>
<server>
<keys>
<algorithm xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">1024</algorithm>
<public-key>{extracted_key}</public-key>
</keys>
</server>
</software-download>
"""
download_reply_xml = nc.custom_rpc_request(download_rpc_xml)
nc.logger.info("Downloading software...")
time.sleep(60)
if download_reply_xml:
nc.logger.info("Download proceed.")
download_data = xmltodict.parse(download_reply_xml)
nc.software_reply_json_logger.info('', extra={'
data
': json.dumps(download_data)})
install_rpc_xml = f"""
<software-install xmlns="urn:o-ran:software-management:1.0">
<slot-name>{nonrunning_slot_name}</slot-name>
<file-names>{{firmware_name}}</file-names>
</software-install>
"""
install_reply_xml = nc.custom_rpc_request(install_rpc_xml)
nc.logger.info("Installing software...")
time.sleep(60)
if install_reply_xml:
nc.logger.info("Installation proceed.")
install_data = xmltodict.parse(install_reply_xml)
nc.software_reply_json_logger.info('', extra={'
data
': json.dumps(install_data)})
if nonrunning_slot_name_build_version in "{{firmware_name}}":
activate_rpc_xml = f"""
<software-activate xmlns="urn:o-ran:software-management:1.0">
<slot-name>{nonrunning_slot_name}</slot-name>
</software-activate>
"""
activate_reply_xml = nc.custom_rpc_request(activate_rpc_xml)
nc.logger.info("Activating software...")
time.sleep(60)
if activate_reply_xml:
nc.logger.info("Activation proceed.")
activate_data = xmltodict.parse(activate_reply_xml)
nc.software_reply_json_logger.info('', extra={'
data
': json.dumps(activate_data)})
nc.get_inventory()
if nonrunning_slot_name_build_version in "{{firmware_name}}" and active_nonrunning_slot_name:
nc.logger.info("Active non-running slot has the updated build version. Resetting device.")
nc.reset_device()
break
except Exception as e:
nc.logger.debug('
Got
exception
,
waiting
10
seconds
before
reconnecting
...
')
nc.logger.debug(str(e))
time.sleep(10)
finally:
nc.close()
software/ors-amarisoft/ru/lopcomm/stats.jinja2.py
deleted
100644 → 0
View file @
c3244027
#!{{ python_path }}
import
time
import
sys
import
os
import
threading
sys
.
path
.
append
({{
repr
(
buildout_directory_path
)
}})
from
ncclient_common
import
LopcommNetconfClient
# Shared variable to indicate error occurred
error_occurred
=
False
lock
=
threading
.
Lock
()
def
get_notification_continuously
(
nc
):
global
error_occurred
try
:
while
not
error_occurred
:
nc
.
get_notification
()
pass
except
Exception
as
e
:
with
lock
:
error_occurred
=
True
nc
.
logger
.
error
(
f'Error in get_notification_continuously:
{
e
}
'
)
# supervision watchdog keeps on
def
run_supervision_reset_continuously
(
nc
):
global
error_occurred
netconf_check_file
=
'{{ is_netconf_connected }}'
interval
=
60
margin
=
10
try
:
while
not
error_occurred
:
t0
=
time
.
time
()
replied
=
nc
.
supervision_reset
(
interval
,
margin
)
if
replied
:
with
open
(
netconf_check_file
,
"w"
)
as
f
:
f
.
write
(
''
)
elif
os
.
path
.
exists
(
netconf_check_file
):
os
.
remove
(
netconf_check_file
)
t1
=
time
.
time
()
time
.
sleep
(
interval
-
(
t1
-
t0
))
except
Exception
as
e
:
with
lock
:
error_occurred
=
True
nc
.
logger
.
error
(
f'Error in run_supervision_reset_continuously:
{
e
}
'
)
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
(
log_file
=
"{{ log_file }}"
,
json_log_file
=
"{{ json_log_file }}"
,
cfg_json_log_file
=
"{{ cfg_json_log_file }}"
,
supervision_json_log_file
=
"{{ supervision_json_log_file }}"
,
ncsession_json_log_file
=
"{{ ncsession_json_log_file }}"
,
software_json_log_file
=
"{{ software_json_log_file }}"
,
supervision_reply_json_log_file
=
"{{ supervision_reply_json_log_file }}"
)
threads
=
[]
try
:
nc
.
connect
(
"{{ netaddr.IPAddress(vtap.gateway) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
subscribe
()
notification_thread
=
threading
.
Thread
(
target
=
get_notification_continuously
,
args
=
(
nc
,))
supervision_thread
=
threading
.
Thread
(
target
=
run_supervision_reset_continuously
,
args
=
(
nc
,))
threads
.
append
(
notification_thread
)
threads
.
append
(
supervision_thread
)
for
thread
in
threads
:
thread
.
start
()
for
thread
in
threads
:
thread
.
join
()
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/slaplte.jinja2
View file @
fde5620b
...
...
@@ -34,17 +34,6 @@
'tx_dbm': 0,
},
'ru/lopcomm': {
'n_antenna_dl': 2,
'n_antenna_ul': 2,
},
'ru/lopcomm/cpri_link': {
'mapping': 'hw',
'rx_delay': 25.11,
'tx_delay': 14.71,
'tx_dbm': 63,
},
'ru/sunwave': {
'n_antenna_dl': 2,
'n_antenna_ul': 1,
...
...
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