def __init__(self, **kwargs):

        EmpowerApp.__init__(self, **kwargs)

        self.graphData = {}
        self.wifi_data = {}

        # List of VBSes active
        self.vbses = []
        # List of WTPs active
        self.wtps = []

        # Populate exsiting VBSes
        for vbs in self.tenant.vbses.values():
            if vbs.connection:
                self.vbses.append(vbs)

        # Populate exsiting WTPs and trigger UCQM for existing WTPs
        for wtp in self.tenant.wtps.values():
            if wtp.connection:
                self.wtps.append(wtp.addr.to_str())

                for block in wtp.supports:
                    ucqm(block=block,
                         tenant_id=self.tenant.tenant_id,
                         every=5000,
                         callback=self.ucqm_callback)

        # Generating inital coordinates for the graph nodes
        self.coord = self.get_coordinates()

        vbsup(tenant_id=self.tenant.tenant_id, callback=self.vbs_up_callback)
        vbsdown(tenant_id=self.tenant.tenant_id, callback=self.vbs_down_callback)

        uejoin(tenant_id=self.tenant.tenant_id, callback=self.ue_join_callback)
        ueleave(tenant_id=self.tenant.tenant_id, callback=self.ue_leave_callback)

        wtpup(tenant_id=self.tenant.tenant_id, callback=self.wtp_up_callback)
        wtpdown(tenant_id=self.tenant.tenant_id, callback=self.wtp_up_callback)
Example #2
0
    def run_once(self):
        """Send out RRC measurements request."""

        if self.tenant_id not in RUNTIME.tenants:
            self.log.info("Tenant %s not found", self.tenant_id)
            self.unload()
            return

        tenant = RUNTIME.tenants[self.tenant_id]

        ue_addr = (self.vbs, self.ue)

        if ue_addr not in tenant.ues:
            self.log.info("UE %s not found", ue_addr)
            return

        ue = tenant.ues[ue_addr]

        if not ue.vbs.connection or ue.vbs.connection.stream.closed():
            self.log.info("VBS %s not connected", ue.vbs.addr)
            return

        st_req = self.meas_req

        rrc_m_req = main_pb2.emage_msg()

        enb_id = ether_to_hex(self.vbs)

        create_header(self.module_id, enb_id, rrc_m_req.head)

        # Creating a trigger message to fetch UE's RRC measurements
        trigger_msg = rrc_m_req.te
        trigger_msg.action = main_pb2.EA_ADD

        rrc_m_msg = trigger_msg.mRRC_meas
        rrc_m_req_msg = rrc_m_msg.req

        rrc_m_req_msg.rnti = ue.rnti

        rrc_m_req_msg.rat = RRC_STATS_RAT_TYPE[st_req["rat_type"]]

        rrc_m_req_msg.measId = 0
        rrc_m_req_msg.m_obj.measObjId = 0
        rrc_m_req_msg.r_conf.reportConfId = 0

        if st_req["rat_type"] == "EUTRA":

            m_obj = rrc_m_req_msg.m_obj
            measObj_EUTRA = m_obj.measObj_EUTRA

            measObj_EUTRA.carrier_freq = st_req["carrier_freq"]
            measObj_EUTRA.meas_bw = RRC_STATS_BW[st_req["bandwidth"]]
            if "cells_to_measure" in st_req:
                for c in st_req["cells_to_measure"]:
                    measObj_EUTRA.cells.append(st_req["cells_to_measure"][c])
            if "blacklist_cells" in st_req:
                for c in st_req["blacklist_cells"]:
                    measObj_EUTRA.bkl_cells.append(
                        st_req["blacklist_cells"][c])

        if st_req["rat_type"] == "EUTRA":
            # EUTRA report configuration

            r_conf = rrc_m_req_msg.r_conf
            rc_EUTRA = r_conf.rc_EUTRA

            # Setting default values
            rc_EUTRA.hysteresis = 0
            rc_EUTRA.trigg_time = configs_pb2.TTRIG_ms0
            rc_EUTRA.report_quant = configs_pb2.REPQ_BOTH
            rc_EUTRA.ue_rxtx_time_diff = configs_pb2.UERXTXTD_SETUP

            rc_EUTRA.trigg_quant = \
                            RRC_STATS_TRIGGER_QUANT[st_req["trigger_quantity"]]
            rc_EUTRA.max_rep_cells = st_req["max_report_cells"]
            rc_EUTRA.rep_interval = \
                                RRC_STATS_REPORT_INTR[st_req["report_interval"]]
            rc_EUTRA.rep_amount = \
                                RRC_STATS_NUM_REPORTS[st_req["num_of_reports"]]

            if st_req["report_type"] == "periodical_ref_signal":
                rc_EUTRA.periodical.purpose = \
                                        configs_pb2.PERRP_REPORT_STRONGEST_CELLS

            elif st_req["report_type"] == "A1":

                a1 = rc_EUTRA.a1

                if st_req["threshold1"]["type"] == "RSRP":
                    a1.a1_threshold.RSRP = st_req["threshold1"]["value"]
                else:
                    a1.a1_threshold.RSRQ = st_req["threshold1"]["value"]

            elif st_req["report_type"] == "A2":

                a2 = rc_EUTRA.a2

                if st_req["threshold1"]["type"] == "RSRP":
                    a2.a2_threshold.RSRP = st_req["threshold1"]["value"]
                else:
                    a2.a2_threshold.RSRQ = st_req["threshold1"]["value"]

            elif st_req["report_type"] == "A3":

                a3 = rc_EUTRA.a3

                a3.a3_offset = st_req["a3_offset"]
                a3.report_on_leave = 1

            elif st_req["report_type"] == "A4":

                a4 = rc_EUTRA.a4

                if st_req["threshold1"]["type"] == "RSRP":
                    a4.a4_threshold.RSRP = st_req["threshold1"]["value"]
                else:
                    a4.a4_threshold.RSRQ = st_req["threshold1"]["value"]

            elif st_req["report_type"] == "A5":

                a5 = rc_EUTRA.a5

                if st_req["threshold1"]["type"] == "RSRP":
                    a5.a5_threshold1.RSRP = st_req["threshold1"]["value"]
                else:
                    a5.a5_threshold1.RSRQ = st_req["threshold1"]["value"]

                if st_req["threshold2"]["type"] == "RSRP":
                    a5.a5_threshold2.RSRP = st_req["threshold2"]["value"]
                else:
                    a5.a5_threshold2.RSRQ = st_req["threshold2"]["value"]

        self.log.info("Sending RRC stats request to %s (id=%u)", ue.vbs.addr,
                      self.module_id)

        ue.vbs.connection.stream_send(rrc_m_req)

        ueleave(tenant_id=self.tenant_id, callback=self.ue_leave_callback)
Example #3
0
    def run_once(self):
        """Send out RRC measurements configuration request."""

        if self.tenant_id not in RUNTIME.tenants:
            self.log.info("Tenant %s not found", self.tenant_id)
            self.unload()
            return

        vbses = RUNTIME.tenants[self.tenant_id].vbses

        if self.vbs not in vbses:
            return

        vbs = vbses[self.vbs]

        tenant = RUNTIME.tenants[self.tenant_id]

        ue_addr = (self.vbs, self.ue)

        if ue_addr not in tenant.ues:
            raise ValueError("Invalid ue rnti")

        ue = tenant.ues[ue_addr]

        if not vbs.connection or vbs.connection.stream.closed():
            self.log.info("VBS %s not connected", vbs.addr)
            return

        cf_req = self.conf_req

        rrc_m_conf_req = main_pb2.emage_msg()

        enb_id = ether_to_hex(self.vbs)

        create_header(self.module_id, enb_id, rrc_m_conf_req.head)

        # Creating a message to fetch UEs RRC measurement configuration
        event_type_msg = None
        if cf_req["event_type"] == "trigger":
            event_type_msg = rrc_m_conf_req.te
            event_type_msg.action = main_pb2.EA_ADD
        elif cf_req["event_type"] == "schedule":
            event_type_msg = rrc_m_conf_req.sche
            event_type_msg.action = main_pb2.EA_ADD
            event_type_msg.interval = cf_req["periodicity"]
        else:
            event_type_msg = rrc_m_conf_req.se

        rrc_m_conf_msg = event_type_msg.mUE_rrc_meas_conf
        rrc_m_conf_req_msg = rrc_m_conf_msg.req

        rrc_m_conf_req_msg.rnti = ue.rnti

        connection = vbs.connection

        self.log.info("Sending UEs RRC meas. config req to %s (id=%u)",
                      vbs.addr, self.module_id)

        vbs.connection.stream_send(rrc_m_conf_req)

        ueleave(tenant_id=self.tenant_id, callback=self.ue_leave_callback)
    def run_once(self):
        """Send out RRC measurements configuration request."""

        if self.tenant_id not in RUNTIME.tenants:
            self.log.info("Tenant %s not found", self.tenant_id)
            self.unload()
            return

        vbses = RUNTIME.tenants[self.tenant_id].vbses

        if self.vbs not in vbses:
            return

        vbs = vbses[self.vbs]

        tenant = RUNTIME.tenants[self.tenant_id]

        ue_addr = (self.vbs, self.ue)

        if ue_addr not in tenant.ues:
            raise ValueError("Invalid ue rnti")

        ue = tenant.ues[ue_addr]

        if not vbs.connection or vbs.connection.stream.closed():
            self.log.info("VBS %s not connected", vbs.addr)
            return

        cf_req = self.conf_req

        rrc_m_conf_req = main_pb2.emage_msg()

        enb_id = ether_to_hex(self.vbs)

        create_header(self.module_id, enb_id, rrc_m_conf_req.head)

        # Creating a message to fetch UEs RRC measurement configuration
        event_type_msg = None
        if cf_req["event_type"] == "trigger":
            event_type_msg = rrc_m_conf_req.te
            event_type_msg.action = main_pb2.EA_ADD
        elif cf_req["event_type"] == "schedule":
            event_type_msg = rrc_m_conf_req.sche
            event_type_msg.action = main_pb2.EA_ADD
            event_type_msg.interval = cf_req["periodicity"]
        else:
            event_type_msg = rrc_m_conf_req.se

        rrc_m_conf_msg = event_type_msg.mUE_rrc_meas_conf
        rrc_m_conf_req_msg = rrc_m_conf_msg.req

        rrc_m_conf_req_msg.rnti = ue.rnti

        connection = vbs.connection

        self.log.info("Sending UEs RRC meas. config req to %s (id=%u)", vbs.addr,
                      self.module_id)

        vbs.connection.stream_send(rrc_m_conf_req)

        ueleave(tenant_id=self.tenant_id, callback=self.ue_leave_callback)
    def run_once(self):
        """Send out RRC measurements request."""

        if self.tenant_id not in RUNTIME.tenants:
            self.log.info("Tenant %s not found", self.tenant_id)
            self.unload()
            return

        tenant = RUNTIME.tenants[self.tenant_id]

        ue_addr = (self.vbs, self.ue)

        if ue_addr not in tenant.ues:
            self.log.info("UE %s not found", ue_addr)
            return

        ue = tenant.ues[ue_addr]

        if not ue.vbs.connection or ue.vbs.connection.stream.closed():
            self.log.info("VBS %s not connected", ue.vbs.addr)
            return

        st_req = self.meas_req

        rrc_m_req = main_pb2.emage_msg()

        enb_id = ether_to_hex(self.vbs)

        create_header(self.module_id, enb_id, rrc_m_req.head)

        # Creating a trigger message to fetch UE's RRC measurements
        trigger_msg = rrc_m_req.te
        trigger_msg.action = main_pb2.EA_ADD

        rrc_m_msg = trigger_msg.mRRC_meas
        rrc_m_req_msg = rrc_m_msg.req

        rrc_m_req_msg.rnti = ue.rnti

        rrc_m_req_msg.rat = RRC_STATS_RAT_TYPE[st_req["rat_type"]]

        rrc_m_req_msg.measId = 0
        rrc_m_req_msg.m_obj.measObjId = 0
        rrc_m_req_msg.r_conf.reportConfId = 0

        if st_req["rat_type"] == "EUTRA":

            m_obj = rrc_m_req_msg.m_obj
            measObj_EUTRA = m_obj.measObj_EUTRA

            measObj_EUTRA.carrier_freq = st_req["carrier_freq"]
            measObj_EUTRA.meas_bw = RRC_STATS_BW[st_req["bandwidth"]]
            if "cells_to_measure" in st_req:
                for c in st_req["cells_to_measure"]:
                    measObj_EUTRA.cells.append(st_req["cells_to_measure"][c])
            if "blacklist_cells" in st_req:
                for c in st_req["blacklist_cells"]:
                    measObj_EUTRA.bkl_cells.append(st_req["blacklist_cells"][c])

        if st_req["rat_type"] == "EUTRA":
            # EUTRA report configuration

            r_conf = rrc_m_req_msg.r_conf
            rc_EUTRA = r_conf.rc_EUTRA

            # Setting default values
            rc_EUTRA.hysteresis = 0
            rc_EUTRA.trigg_time = configs_pb2.TTRIG_ms0
            rc_EUTRA.report_quant = configs_pb2.REPQ_BOTH
            rc_EUTRA.ue_rxtx_time_diff = configs_pb2.UERXTXTD_SETUP

            rc_EUTRA.trigg_quant = \
                            RRC_STATS_TRIGGER_QUANT[st_req["trigger_quantity"]]
            rc_EUTRA.max_rep_cells = st_req["max_report_cells"]
            rc_EUTRA.rep_interval = \
                                RRC_STATS_REPORT_INTR[st_req["report_interval"]]
            rc_EUTRA.rep_amount = \
                                RRC_STATS_NUM_REPORTS[st_req["num_of_reports"]]

            if st_req["report_type"] == "periodical_ref_signal":
                rc_EUTRA.periodical.purpose = \
                                        configs_pb2.PERRP_REPORT_STRONGEST_CELLS

            elif st_req["report_type"] == "A1":

                a1 = rc_EUTRA.a1

                if st_req["threshold1"]["type"] == "RSRP":
                    a1.a1_threshold.RSRP = st_req["threshold1"]["value"]
                else:
                    a1.a1_threshold.RSRQ = st_req["threshold1"]["value"]

            elif st_req["report_type"] == "A2":

                a2 = rc_EUTRA.a2

                if st_req["threshold1"]["type"] == "RSRP":
                    a2.a2_threshold.RSRP = st_req["threshold1"]["value"]
                else:
                    a2.a2_threshold.RSRQ = st_req["threshold1"]["value"]

            elif st_req["report_type"] == "A3":

                a3 = rc_EUTRA.a3

                a3.a3_offset = st_req["a3_offset"]
                a3.report_on_leave = 1

            elif st_req["report_type"] == "A4":

                a4 = rc_EUTRA.a4

                if st_req["threshold1"]["type"] == "RSRP":
                    a4.a4_threshold.RSRP = st_req["threshold1"]["value"]
                else:
                    a4.a4_threshold.RSRQ = st_req["threshold1"]["value"]

            elif st_req["report_type"] == "A5":

                a5 = rc_EUTRA.a5

                if st_req["threshold1"]["type"] == "RSRP":
                    a5.a5_threshold1.RSRP = st_req["threshold1"]["value"]
                else:
                    a5.a5_threshold1.RSRQ = st_req["threshold1"]["value"]

                if st_req["threshold2"]["type"] == "RSRP":
                    a5.a5_threshold2.RSRP = st_req["threshold2"]["value"]
                else:
                    a5.a5_threshold2.RSRQ = st_req["threshold2"]["value"]

        self.log.info("Sending RRC stats request to %s (id=%u)", ue.vbs.addr,
                      self.module_id)

        ue.vbs.connection.stream_send(rrc_m_req)

        ueleave(tenant_id=self.tenant_id, callback=self.ue_leave_callback)