Skip to content

Commit

Permalink
update code that integrates the connection of test xapp to get xapp.
Browse files Browse the repository at this point in the history
  • Loading branch information
tangecemsu committed Dec 31, 2022
1 parent 7560e90 commit 16709d0
Show file tree
Hide file tree
Showing 85 changed files with 24 additions and 7,024 deletions.
Binary file modified actor/src/actions/__pycache__/actions_vr.cpython-38.pyc
Binary file not shown.
Binary file modified actor/src/actions/__pycache__/xapp_connection.cpython-38.pyc
Binary file not shown.
23 changes: 13 additions & 10 deletions actor/src/actions/xapp_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,29 @@ def send_msg(self, msg_dict):
def waiting_server_thread(self, socket):
# msg_handler = MessageHandler(self)
print("Just send some fake data......")
for i in range(100):
time.sleep(2)
message_sent = {"type": "KPI xApp", "timestamp": str(i),
"kpi1": str(i+100), "kpi2": str(i+200), "kpi3": str(i+300)}
self.server_connection.send_msg(message_sent)
return
#for i in range(100):
# time.sleep(2)
# message_sent = {"type": "KPI xApp", "timestamp": str(i),
# "kpi1": str(i+100), "kpi2": str(i+200), "kpi3": str(i+300)}
# self.server_connection.send_msg(message_sent)
#return

while True:
# this thread is created to wait new message received from server
data = socket.recv(1024)
data = data.decode("utf-8")
#data = data.decode("utf-8")

if not data:
break

logger.info('<<-- Receive a message from the server : {}'.format(data))

#message = json.loads(data)

message = data.decode("utf-8")
message = json.loads(message)
print("Received a KPI data from test xApp: ")
print(message)
# message_handler.handle(message)
self.server_connection.send_msg(data) ## forward this message to the oaic-t server
self.server_connection.send_msg(message) ## forward this message to the oaic-t server

# close the connection
print('Server disconnected!')
Expand Down
Binary file modified server/src/__pycache__/actor_manager.cpython-38.pyc
Binary file not shown.
Binary file modified server/src/__pycache__/message_handler.cpython-38.pyc
Binary file not shown.
Binary file modified server/src/__pycache__/researchGUI.cpython-38.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions server/src/actor_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ def update_actor_rsc(self, actor_name, actor_rsc):
self.ui.actor_rsc_updated(actor_name, float(actor_rsc.cpu), float(actor_rsc.mem))

def update_kpi_xapp(self, ts, kpi_all):
if self.ui & kpi_all:
self.ui.actor_kpi_updated(ts)
if self.ui:
self.ui.actor_kpi_updated(ts, kpi_all)

def update_test_status(self, test_id, status):
test_task = self.find_test_task(test_id)
Expand Down
15 changes: 9 additions & 6 deletions server/src/message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,35 @@ def handle(self, actor, message, actor_manager):
output_summary = message['output summary']
actor_manager.update_test_logs(task_id, ">>>>>> Details:" + output_summary)
elif message['type'] == "KPI xApp":
# print("Received KPI xApp data: ")
# print(message)
print("Received KPI xApp data: ")
print(message)
message_sent = {"type": "confirmed"}
kpi_all_dict = dict()
ue_kpi_kept = ["PRB-Usage-DL", "PRB-Usage-UL", "QCI", "fiveQI", "MeasPeriodUEPRBUsage", "Meas-Period-PDCP", "Meas-Period-RF", "Number-of-Active-UEs"]
cell_kpi_kept = ["PDCP-Bytes-DL", "PDCP-Bytes-UL", "Avail-PRB-DL", "Avail-PRB-UL", "Meas-Period-PDCPBytes", "MeasPeriodAvailPRB", "Total-Available-PRBs-DL",
"Total-Available-PRBs-UL"]

count_ue = 0
count_cell = 0
count = 0
if "UE Metrics" in message.keys():
count_ue = 0
ue_metrics = message["UE Metrics"]
ue_metrics = json.loads(ue_metrics[0][0], strict=False)
for k in ue_metrics.keys():
# if k.startswith("kpi"):
if k in ue_kpi_kept:
kpi_all_dict[count] = float(message[k])
kpi_all_dict["UE_"+k] = float(ue_metrics[k])
count_ue += 1
count += 1
if "Cell Metrics" in message.keys():
count_cell = 0
cell_metrics = message["Cell Metrics"]
cell_metrics = json.loads(cell_metrics[0][0], strict=False)
for k in cell_metrics.keys():
#if k.startswith("kpi"):
if k in cell_kpi_kept:
kpi_all_dict[count] = float(message[k])
kpi_all_dict["Cell_"+k] = float(cell_metrics[k])
count_cell += 1
count += 1
#timestamp = message["timestamp"]
print("KPI metrics received: " + str(count_ue) + " UE metrics, " + str(count_cell) + " Cell metrics!")
if (count_ue + count_cell) >= 1:
Expand Down
674 changes: 0 additions & 674 deletions updated/oaic-t/LICENSE

This file was deleted.

30 changes: 0 additions & 30 deletions updated/oaic-t/README.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 0 additions & 24 deletions updated/oaic-t/actor/src/action_factory.py

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
28 changes: 0 additions & 28 deletions updated/oaic-t/actor/src/actions/action_executor.py

This file was deleted.

147 changes: 0 additions & 147 deletions updated/oaic-t/actor/src/actions/actions_srsue.py

This file was deleted.

Loading

0 comments on commit 16709d0

Please sign in to comment.