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

wip

parent ed36fafb
......@@ -44,7 +44,7 @@ md5sum = b7906ca3a6b17963f78f680fc0842b74
[ru_lopcomm_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/lopcomm/libinstance.jinja2.cfg
md5sum = 5aa994705fc5e130e4fb372e10d3cbde
md5sum = fc671b78f3d8ee6d39a00d48fabf241a
[ru_sunwave_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sunwave/libinstance.jinja2.cfg
......@@ -52,11 +52,11 @@ md5sum = bc5d82b8737b6990674b280ef2774be7
[ru_lopcomm_ncclient_common.py]
_update_hash_filename_ = ru/lopcomm/ncclient_common.py
md5sum = 5cc878f4c596335a1b6d90e1c03b53a5
md5sum = c0c0e2eccff46893f5595df8ea8d7fe8
[ru_lopcomm_delay.jinja2.py]
_update_hash_filename_ = ru/lopcomm/delay.jinja2.py
md5sum = 357847ea3aabbf08156466d113521cbe
md5sum = aa1cace87c12e5e225168cd1a962895e
[ru_lopcomm_stats.jinja2.py]
_update_hash_filename_ = ru/lopcomm/stats.jinja2.py
......
......@@ -16,20 +16,9 @@ if __name__ == '__main__':
while True:
try:
nc.connect("{{ netaddr.IPAddress(vtap.gateway) }}", 830, "oranuser", "oranpassword")
nc.delay_management()
nc.logger.info("Processing with delay parameters...")
delay_rpc_xml = f"""
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter type="xpath" xmlns:o-ran-delay-ru-cpri="urn:o-ran:delay-ru-cpri:1.0" select="/o-ran-delay-ru-cpri:ru-delay-profile" />
</get>
"""
delay_reply_xml = nc.custom_rpc_request(delay_rpc_xml)
nc.logger.info("Getting delay parameters...")
time.sleep(60)
if delay_reply_xml:
nc.logger.info("Got delay parameter.")
delay_data = xmltodict.parse(delay_reply_xml)
nc.delay_reply_json_logger.info('', extra={'data': json.dumps(delay_data)})
break
except Exception as e:
nc.logger.debug('Got exception, waiting 10 seconds before reconnecting...')
nc.logger.debug(str(e))
......
......@@ -26,16 +26,14 @@ recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
_logbase = ${directory:var}/log/{{B('%s-delay' % ru_ref)}}
log-output = ${:_logbase}.log
delay-reply-json-log-output = ${:_logbase}-reply.json.log
json-log-output = ${:_logbase}.json.log
context =
section directory directory
section vtap vtap.{{ ru.cpri_link._tap }}
key slapparameter_dict myslap:parameter_dict
key log_file :log-output
key delay_reply_json_log_file :delay-reply-json-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
raw buildout_directory_path {{ buildout_directory }}
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_delay_template }}
......
......@@ -226,6 +226,22 @@ class LopcommNetconfClient:
self.supervision_reply_json_logger.info('', extra={'data': json.dumps(supervision_watchdog_data)})
return replied
def delay_management(self):
self.logger.info('Getting delay parameters...')
delay_rpc_xml = """
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter type="xpath" xmlns:o-ran-delay-ru-cpri="urn:o-ran:delay-ru-cpri:1.0" select="/o-ran-delay-ru-cpri:ru-delay-profile" />
</get>
"""
delay_reply_xml = self.custom_rpc_request(delay_rpc_xml)
if delay_reply_xml:
nc.logger.info("Got delay parameter.")
delay_data = xmltodict.parse(delay_reply_xml)
if self.delay_reply_json_logger:
self.delay_reply_json_logger.info('', extra={'data': json.dumps(delay_data)})
time.sleep(60)
def close(self):
# Close not compatible between ncclient and netconf server
#self.conn.close()
......
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