def cleanup(self): """Remove this module.""" self.log.info("Cleanup %s (id=%u)", self.module_type, self.module_id) vbses = RUNTIME.tenants[self.tenant_id].vbses if self.vbs not in vbses: return vbs = vbses[self.vbs] ue_addr = (self.vbs, self.ue) if ue_addr not in RUNTIME.tenants[self.tenant_id].ues: return ue = RUNTIME.tenants[self.tenant_id].ues[ue_addr] if not vbs.connection or vbs.connection.stream.closed(): self.log.info("VBS %s not connected", vbs.addr) return meas = self.meas for m in meas.keys(): if m in ue.rrc_meas: del ue.rrc_meas[m] rrc_m_req = main_pb2.emage_msg() enb_id = ether_to_hex(self.vbs) # Transaction identifier is zero by default. create_header(self.module_id, enb_id, rrc_m_req.head) # Creating a trigger message to delete UE's RRC measurements trigger trigger_msg = rrc_m_req.te trigger_msg.action = main_pb2.EA_DEL 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.measId = 0 rrc_m_req_msg.m_obj.measObjId = 0 rrc_m_req_msg.r_conf.reportConfId = 0 meas_req = self.meas_req rrc_m_req_msg.rat = RRC_STATS_RAT_TYPE[meas_req["rat_type"]] connection = vbs.connection enb_id = connection.vbs.enb_id vbs.connection.stream_send(rrc_m_req)
def cleanup(self): """Remove this module.""" self.log.info("Cleanup %s (id=%u)", self.module_type, self.module_id) 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: return 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_DEL elif cf_req["event_type"] == "schedule": event_type_msg = rrc_m_conf_req.sche event_type_msg.action = main_pb2.EA_DEL else: return 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 vbs.connection.stream_send(rrc_m_conf_req)
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 tenant = RUNTIME.tenants[self.tenant_id] if self.ue not in tenant.ues: self.log.info("UE %s not found", self.ue) self.unload() return ue = tenant.ues[self.ue] if not ue.vbs.connection or ue.vbs.connection.stream.closed(): self.log.info("VBS %s not connected", ue.vbs.addr) self.unload() return cf_req = self.conf_req rrc_m_conf_req = main_pb2.emage_msg() create_header(self.module_id, ue.vbs.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 self.log.info("Sending UEs RRC meas. config req to %s (id=%u)", ue.vbs.addr, self.module_id) ue.vbs.connection.stream_send(rrc_m_conf_req)
def remove_trigger_from_vbs(self): """Remove this module.""" self.log.info("UEs RRC meas. config Cleanup %s (id=%u)", self.module_type, self.module_id) ue = RUNTIME.tenants[self.tenant_id].ues[self.ue] if not ue.vbs.connection or ue.vbs.connection.stream.closed(): self.log.info("VBS %s not connected", ue.vbs.addr) self.unload() return cf_req = self.conf_req rrc_m_conf_req = main_pb2.emage_msg() create_header(self.module_id, ue.vbs.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_DEL elif cf_req["event_type"] == "schedule": event_type_msg = rrc_m_conf_req.sche event_type_msg.action = main_pb2.EA_DEL else: return 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 self.log.info("Sending UEs Del RRC meas. config req to %s (id=%u)", ue.vbs.addr, self.module_id) ue.vbs.connection.stream_send(rrc_m_conf_req)
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)
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)