Commit 596c6f36 authored by hardy's avatar hardy

poc : stats monitoring

parent bb6d7b21
...@@ -154,6 +154,7 @@ def GetParametersFromXML(action): ...@@ -154,6 +154,7 @@ def GetParametersFromXML(action):
elif action == 'Initialize_eNB': elif action == 'Initialize_eNB':
RAN.eNB_Trace=test.findtext('eNB_Trace') RAN.eNB_Trace=test.findtext('eNB_Trace')
RAN.eNB_Stats=test.findtext('eNB_Stats')
RAN.Initialize_eNB_args=test.findtext('Initialize_eNB_args') RAN.Initialize_eNB_args=test.findtext('Initialize_eNB_args')
eNB_instance=test.findtext('eNB_instance') eNB_instance=test.findtext('eNB_instance')
USRPIPAddress=test.findtext('USRP_IPAddress') USRPIPAddress=test.findtext('USRP_IPAddress')
......
...@@ -94,6 +94,7 @@ class RANManagement(): ...@@ -94,6 +94,7 @@ class RANManagement():
self.runtime_stats= '' self.runtime_stats= ''
self.datalog_rt_stats={} self.datalog_rt_stats={}
self.eNB_Trace = '' #if 'yes', Tshark will be launched at initialization self.eNB_Trace = '' #if 'yes', Tshark will be launched at initialization
self.eNB_Stats = '' #if 'yes', Statistics Monitor will be launched at initialization
self.USRPIPAddress = '' self.USRPIPAddress = ''
...@@ -539,6 +540,23 @@ class RANManagement(): ...@@ -539,6 +540,23 @@ class RANManagement():
self.eNBstatuses[int(self.eNB_instance)] = int(self.eNB_serverId[self.eNB_instance]) self.eNBstatuses[int(self.eNB_instance)] = int(self.eNB_serverId[self.eNB_instance])
mySSH.close() mySSH.close()
#if enabled in the xml,
#copyout the monitor script and launch it
if self.eNB_Stats=='yes':
mySSH.open(lIpAddr, lUserName, lPassWord)
monitor_file='stats_monitor.py'
mySSH.command('echo ' + lPassWord + ' | sudo -S cp ' + self.eNBSourceCodePath + '/ci-scripts/'+ monitor_file + ' ' + self.eNBSourceCodePath + '/cmake_targets/ran_build/build/.','\$', 5)
#launch, it will stop when the softmodem stops
mySSH.command('echo $USER; nohup python3 ' + self.eNBSourceCodePath + '/cmake_targets/ran_build/build/' + monitor_file + ' 2>&1 &', '\$', 5)
mySSH.close()
HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'OK', CONST.ALL_PROCESSES_OK)
logging.debug('\u001B[1m Initialize eNB/gNB/ocp-eNB Completed\u001B[0m') logging.debug('\u001B[1m Initialize eNB/gNB/ocp-eNB Completed\u001B[0m')
...@@ -690,8 +708,10 @@ class RANManagement(): ...@@ -690,8 +708,10 @@ class RANManagement():
mySSH.command('cd cmake_targets', '\$', 5) mySSH.command('cd cmake_targets', '\$', 5)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/enb_*.pcap .','\$',20) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/enb_*.pcap .','\$',20)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/gnb_*.pcap .','\$',20) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/gnb_*.pcap .','\$',20)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/*monitor.pickle .','\$',20)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/*monitor.png .','\$',20)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 60) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor.png', '\$', 60)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 5) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 5)
mySSH.close() mySSH.close()
......
...@@ -6,6 +6,7 @@ import sys ...@@ -6,6 +6,7 @@ import sys
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import pickle import pickle
import numpy as np import numpy as np
import os
def collect(d): def collect(d):
cmd='cat L1_stats.log MAC_stats.log PDCP_stats.log RRC_stats.log' cmd='cat L1_stats.log MAC_stats.log PDCP_stats.log RRC_stats.log'
...@@ -60,7 +61,7 @@ def graph(d): ...@@ -60,7 +61,7 @@ def graph(d):
plt.tight_layout() plt.tight_layout()
# Combine all the operations and display # Combine all the operations and display
plt.savefig('/tmp/radio_monitor_dump.png') plt.savefig('/tmp/stats_monitor.png')
plt.show() plt.show()
if __name__ == "__main__": if __name__ == "__main__":
...@@ -82,7 +83,7 @@ if __name__ == "__main__": ...@@ -82,7 +83,7 @@ if __name__ == "__main__":
output = process.stdout.readlines() output = process.stdout.readlines()
time.sleep(1) time.sleep(1)
print('process stopped') print('process stopped')
with open('/tmp/radio_monitor_dump.pickle', 'wb') as handle: with open('/tmp/stats_monitor.pickle', 'wb') as handle:
pickle.dump(d, handle, protocol=pickle.HIGHEST_PROTOCOL) pickle.dump(d, handle, protocol=pickle.HIGHEST_PROTOCOL)
graph(d) graph(d)
......
...@@ -64,20 +64,11 @@ ...@@ -64,20 +64,11 @@
<eNB_serverId>0</eNB_serverId> <eNB_serverId>0</eNB_serverId>
<air_interface>lte</air_interface> <air_interface>lte</air_interface>
<eNB_Trace>yes</eNB_Trace> <eNB_Trace>yes</eNB_Trace>
<eNB_Stats>yes</eNB_Stats>
<USRP_IPAddress>192.168.18.241</USRP_IPAddress> <USRP_IPAddress>192.168.18.241</USRP_IPAddress>
</testCase> </testCase>
<testCase id="040000">
<class>Initialize_eNB</class>
<desc>Initialize gNB</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q</Initialize_eNB_args>
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
<air_interface>nr</air_interface>
<USRP_IPAddress>192.168.18.240</USRP_IPAddress>
</testCase>
<testCase id="000001"> <testCase id="000001">
<class>IdleSleep</class> <class>IdleSleep</class>
<desc>Sleep</desc> <desc>Sleep</desc>
......
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