Commit 368568b5 authored by Lu Xu's avatar Lu Xu 👀

wip

parent 771bc9ca
...@@ -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
......
...@@ -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))
......
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