Commit ffebd58a authored by Lu Xu's avatar Lu Xu 👀

sw upgrading wip

parent e6fe524e
......@@ -28,7 +28,7 @@ md5sum = c930c28365c685a6066f382c9b5d8893
[ncclient_common]
_update_hash_filename_ = ncclient_common.py
md5sum = 8f8b4a45e300f2caa3a5261d47a88639
md5sum = bd2866db984fdf24605d2d60abbe807a
[lopcomm-rrh-stats.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-stats.jinja2.py
......@@ -40,11 +40,11 @@ md5sum = 20764fa7554d90d040f3847a9573ef93
[lopcomm-rrh-software.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-software.jinja2.py
md5sum = 1dab59eec5b5df9869ea16d2c68e85b0
md5sum = 673516819477d924f94315ffc734a1cc
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = dbe9dd2e7b0d84bcef3a3c7f217d9d6d
md5sum = d33c06a2bc32796af4fa3064380d2544
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
......
......@@ -118,6 +118,16 @@
"textarea": true,
"type": "string"
},
"customised_download_rpc_xml": {
"title": "Firmware Download XML",
"description": "Customised firmware download XML",
"type": "string"
},
"firmware_name": {
"title": "Lopcomm Firmware Name",
"description": "Lopcomm firmware name. It is used to compare the current running version.",
"type": "string"
},
{%- endif %}
"log_phy_debug": {
"title": "Physical layer log debug",
......
......@@ -231,6 +231,7 @@ cfg-json-log-output = ${directory:var}/log/lopcomm-rrh-config.json.log
supervision-json-log-output = ${directory:var}/log/lopcomm-rrh-supervision.json.log
ncsession-json-log-output = ${directory:var}/log/lopcomm-rrh-ncsession.json.log
software-json-log-output = ${directory:var}/log/lopcomm-rrh-software.json.log
remote-file-path = sftp://${user-info:pw-name}@[${slap-configuration:ipv6-random}]:${sshd-port:port}/etc
context =
section directory directory
section slap_configuration slap-configuration
......@@ -244,6 +245,7 @@ context =
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory }}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
raw remote_file_path {{ remote-file-path }}
import netaddr netaddr
mode = 0775
url = {{ lopcomm_rrh_stats_template }}
......
......@@ -117,6 +117,16 @@
"textarea": true,
"type": "string"
},
"customised_download_rpc_xml": {
"title": "Firmware Download XML",
"description": "Customised firmware download XML",
"type": "string"
},
"firmware_name": {
"title": "Lopcomm Firmware Name",
"description": "Lopcomm firmware name. It is used to compare the current running version.",
"type": "string"
},
"log_phy_debug": {
"title": "Physical layer log debug",
"description": "Enable debug mode for physical layer logs",
......
......@@ -26,19 +26,26 @@ if __name__ == '__main__':
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 slapparameter_dict.get('customised_download_rpc_xml') %}
{% set firmware_name = slapparameter_dict.get('firmware_name') %}
{% else %}
{% set firmware_name = "{{ firmware_name }}" %}
{% endif %}
if running_slot_name_build_version in firmware_name:
nc.logger.info("Running slot's build-version %s is already updated. Skipping install." % running_slot_name_build_version)
else:
nc.logger.info("Current build version: %s" % running_slot_name_build_version)
{% if slapparameter_dict.get('customised_download_rpc_xml') %}
download_rpc_xml = f"""
{{ slapparameter_dict.get('customised_download_rpc_xml') }}
"""
{% else %}
download_rpc_xml = f"""
<software-download xmlns="urn:o-ran:software-management:1.0">
<remote-file-path>sftp://test@[2a11:9ac1:6::1]:/home/test/{{ firmware_name }}</remote-file-path>
<password>
<password>123456</password>
</password>
<remote-file-path>{{ remote_file_path }}/{firmware_name}</remote-file-path>
</software-download>
"""
{% endif %}
download_reply_xml = nc.custom_rpc_request(download_rpc_xml)
if download_reply_xml:
download_data = xmltodict.parse(download_reply_xml)
......@@ -47,7 +54,7 @@ if __name__ == '__main__':
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>
<file-names>{firmware_name}</file-names>
</software-install>
"""
install_reply_xml = nc.custom_rpc_request(install_rpc_xml)
......@@ -66,7 +73,7 @@ if __name__ == '__main__':
nc.software_reply_json_logger.info('', extra={'data': activate_data})
nc.get_inventory()
if nonrunning_slot_name_build_version in "{{ firmware_name }}" and active_nonrunning_slot_name:
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment