Skip to content
Snippets Groups Projects
Commit 15c90ac3 authored by mir's avatar mir
Browse files

Python filed ignored by .gitignore added

parent 5e727a42
No related branches found
No related tags found
1 merge request!29Dev to master before release 2
import xapp_sdk as ric
import time
import os
import pdb
####################
#### MAC INDICATION CALLBACK
####################
# MACCallback class is defined and derived from C++ class mac_cb
class MACCallback(ric.mac_cb):
# Define Python class 'constructor'
def __init__(self):
# Call C++ base class constructor
ric.mac_cb.__init__(self)
# Override C++ method: virtual void handle(swig_mac_ind_msg_t a) = 0;
def handle(self, ind):
# Print swig_mac_ind_msg_t
if len(ind.ue_stats) > 0:
t_now = time.time_ns() / 1000.0
t_mac = ind.tstamp / 1.0
t_diff = t_now - t_mac
print('MAC Indication tstamp = ' + str(t_mac) + ' latency = ' + str(t_diff) + ' μs')
# print('MAC rnti = ' + str(ind.ue_stats[0].rnti))
####################
#### RLC INDICATION CALLBACK
####################
class RLCCallback(ric.rlc_cb):
# Define Python class 'constructor'
def __init__(self):
# Call C++ base class constructor
ric.rlc_cb.__init__(self)
# Override C++ method: virtual void handle(swig_rlc_ind_msg_t a) = 0;
def handle(self, ind):
# Print swig_rlc_ind_msg_t
if len(ind.rb_stats) > 0:
t_now = time.time_ns() / 1000.0
t_rlc = ind.tstamp / 1.0
t_diff = t_now - t_rlc
print('RLC Indication tstamp = ' + str(ind.tstamp) + ' latency = ' + str(t_diff) + ' μs')
# print('RLC rnti = '+ str(ind.rb_stats[0].rnti))
####################
#### PDCP INDICATION CALLBACK
####################
class PDCPCallback(ric.pdcp_cb):
# Define Python class 'constructor'
def __init__(self):
# Call C++ base class constructor
ric.pdcp_cb.__init__(self)
# Override C++ method: virtual void handle(swig_pdcp_ind_msg_t a) = 0;
def handle(self, ind):
# Print swig_pdcp_ind_msg_t
if len(ind.rb_stats) > 0:
t_now = time.time_ns() / 1000.0
t_pdcp = ind.tstamp / 1.0
t_diff = t_now - t_pdcp
print('PDCP Indication tstamp = ' + str(ind.tstamp) + ' latency = ' + str(t_diff) + ' μs')
# print('PDCP rnti = '+ str(ind.rb_stats[0].rnti))
####################
#### GTP INDICATION CALLBACK
####################
# Create a callback for GTP which derived it from C++ class gtp_cb
class GTPCallback(ric.gtp_cb):
def __init__(self):
# Inherit C++ gtp_cb class
ric.gtp_cb.__init__(self)
# Create an override C++ method
def handle(self, ind):
if len(ind.gtp_stats) > 0:
t_now = time.time_ns() / 1000.0
t_gtp = ind.tstamp / 1.0
t_diff = t_now - t_gtp
print('GTP Indication tstamp = ' + str(ind.tstamp) + ' diff = ' + str(t_diff) + ' μs')
####################
#### GENERAL
####################
ric.init()
conn = ric.conn_e2_nodes()
assert(len(conn) > 0)
for i in range(0, len(conn)):
print("Global E2 Node [" + str(i) + "]: PLMN MCC = " + str(conn[i].id.plmn.mcc))
print("Global E2 Node [" + str(i) + "]: PLMN MNC = " + str(conn[i].id.plmn.mnc))
####################
#### MAC INDICATION
####################
mac_hndlr = []
for i in range(0, len(conn)):
mac_cb = MACCallback()
hndlr = ric.report_mac_sm(conn[i].id, ric.Interval_ms_1, mac_cb)
mac_hndlr.append(hndlr)
time.sleep(1)
####################
#### RLC INDICATION
####################
rlc_hndlr = []
for i in range(0, len(conn)):
rlc_cb = RLCCallback()
hndlr = ric.report_rlc_sm(conn[i].id, ric.Interval_ms_1, rlc_cb)
rlc_hndlr.append(hndlr)
time.sleep(1)
####################
#### PDCP INDICATION
####################
pdcp_hndlr = []
for i in range(0, len(conn)):
pdcp_cb = PDCPCallback()
hndlr = ric.report_pdcp_sm(conn[i].id, ric.Interval_ms_1, pdcp_cb)
pdcp_hndlr.append(hndlr)
time.sleep(1)
####################
#### GTP INDICATION
####################
gtp_hndlr = []
for i in range(0, len(conn)):
gtp_cb = GTPCallback()
hndlr = ric.report_gtp_sm(conn[i].id, ric.Interval_ms_1, gtp_cb)
gtp_hndlr.append(hndlr)
time.sleep(1)
time.sleep(10)
### End
for i in range(0, len(mac_hndlr)):
ric.rm_report_mac_sm(mac_hndlr[i])
for i in range(0, len(rlc_hndlr)):
ric.rm_report_rlc_sm(rlc_hndlr[i])
for i in range(0, len(pdcp_hndlr)):
ric.rm_report_pdcp_sm(pdcp_hndlr[i])
for i in range(0, len(gtp_hndlr)):
ric.rm_report_gtp_sm(gtp_hndlr[i])
# Avoid deadlock. ToDo revise architecture
while ric.try_stop == 0:
time.sleep(1)
print("Test finished")
......@@ -32,18 +32,18 @@ RUN cd swig && ./autogen.sh && ./configure --prefix=/usr/ && make && make instal
WORKDIR /
#asn1
RUN git clone https://github.com/vlm/asn1c.git /asn1c
RUN cd asn1c && \
autoreconf -iv && \
./configure && \
make && \
make install
#RUN git clone https://github.com/vlm/asn1c.git /asn1c
#RUN cd asn1c && \
# autoreconf -iv && \
# ./configure && \
# make && \
# make install
#flexric
RUN git clone https://gitlab.eurecom.fr/mosaic5g/flexric /flexric
WORKDIR /flexric
RUN git checkout 1bc84a0e3a992517d767150933bd086c3126f4ae
RUN git checkout dev
RUN mkdir build && \
cd build && \
cmake .. && make && make install
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment