本文整理匯總了Python中empower.main.RUNTIME.load_tenant_by_plmn_id方法的典型用法代碼示例。如果您正苦於以下問題:Python RUNTIME.load_tenant_by_plmn_id方法的具體用法?Python RUNTIME.load_tenant_by_plmn_id怎麽用?Python RUNTIME.load_tenant_by_plmn_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類empower.main.RUNTIME
的用法示例。
在下文中一共展示了RUNTIME.load_tenant_by_plmn_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _handle_UEs_id_repl
# 需要導入模塊: from empower.main import RUNTIME [as 別名]
# 或者: from empower.main.RUNTIME import load_tenant_by_plmn_id [as 別名]
def _handle_UEs_id_repl(self, main_msg):
"""Handle an incoming UEs ID reply.
Args:
message, a emage_msg containing UE IDs (RNTIs)
Returns:
None
"""
active_ues = {}
inactive_ues = {}
event_type = main_msg.WhichOneof("event_types")
msg = protobuf_to_dict(main_msg)
ues_id_msg_repl = msg[event_type]["mUEs_id"]["repl"]
if ues_id_msg_repl["status"] != configs_pb2.CREQS_SUCCESS:
return
# List of active UEs
if "active_ue_id" in ues_id_msg_repl:
for ue in ues_id_msg_repl["active_ue_id"]:
active_ues[(self.vbs.addr, ue["rnti"])] = {}
if "imsi" in ue:
active_ues[(self.vbs.addr, ue["rnti"])]["imsi"] = ue["imsi"]
else:
active_ues[(self.vbs.addr, ue["rnti"])]["imsi"] = None
if "plmn_id" in ue:
active_ues[(self.vbs.addr, ue["rnti"])]["plmn_id"] = \
ue["plmn_id"]
else:
active_ues[(self.vbs.addr, ue["rnti"])]["plmn_id"] = None
# List of inactive UEs
if "inactive_ue_id" in ues_id_msg_repl:
for ue in ues_id_msg_repl["inactive_ue_id"]:
inactive_ues[(self.vbs.addr, ue["rnti"])] = {}
if "imsi" in ue:
inactive_ues[(self.vbs.addr, ue["rnti"])]["imsi"] = \
ue["imsi"]
else:
inactive_ues[(self.vbs.addr, ue["rnti"])]["imsi"] = None
if "plmn_id" in ue:
inactive_ues[(self.vbs.addr, ue["rnti"])]["plmn_id"] = \
ue["plmn_id"]
else:
inactive_ues[(self.vbs.addr, ue["rnti"])]["plmn_id"] = None
for vbs_id, rnti in active_ues.keys():
ue_id = (self.vbs.addr, rnti)
if ue_id not in RUNTIME.ues:
new_ue = UE(ue_id, ue_id[1], self.vbs)
RUNTIME.ues[ue_id] = new_ue
ue = RUNTIME.ues[ue_id]
imsi = active_ues[ue_id]["imsi"]
plmn_id = int(active_ues[ue_id]["plmn_id"])
# Setting IMSI of UE
ue.imsi = imsi
if not ue.plmn_id and plmn_id:
# Setting tenant
ue.tenant = RUNTIME.load_tenant_by_plmn_id(plmn_id)
if ue.tenant:
# Adding UE to tenant
LOG.info("Adding %s to tenant %s", ue.addr,
ue.tenant.plmn_id)
ue.tenant.ues[ue.addr] = ue
# Raise UE join
self.server.send_ue_join_message_to_self(ue)
# Create a trigger for reporting RRC measurements config.
from empower.ue_confs.ue_rrc_meas_confs import ue_rrc_meas_confs
conf_req = {
"event_type": "trigger"
}
ue_rrc_meas_confs(tenant_id=ue.tenant.tenant_id,
vbs=ue.vbs.addr,
ue=ue.rnti,
conf_req=conf_req)
if ue.plmn_id and not plmn_id:
# Raise UE leave
self.server.send_ue_leave_message_to_self(ue)
# Removing UE from tenant
LOG.info("Removing %s from tenant %s", ue.addr,
ue.tenant.plmn_id)
del ue.tenant.ues[ue.addr]
#.........這裏部分代碼省略.........
示例2: _handle_UEs_id_repl
# 需要導入模塊: from empower.main import RUNTIME [as 別名]
# 或者: from empower.main.RUNTIME import load_tenant_by_plmn_id [as 別名]
def _handle_UEs_id_repl(self, main_msg):
"""Handle an incoming UEs ID reply.
Args:
message, a emage_msg containing UE IDs (RNTIs)
Returns:
None
"""
active_ues = {}
inactive_ues = {}
event_type = main_msg.WhichOneof("event_types")
msg = protobuf_to_dict(main_msg)
ues_id_msg_repl = msg[event_type]["mUEs_id"]["repl"]
if ues_id_msg_repl["status"] != configs_pb2.CREQS_SUCCESS:
return
# List of active UEs
if "active_ue_id" in ues_id_msg_repl:
for ue in ues_id_msg_repl["active_ue_id"]:
active_ues[ue["rnti"]] = {}
if "imsi" in ue:
active_ues[ue["rnti"]]["imsi"] = ue["imsi"]
else:
active_ues[ue["rnti"]]["imsi"] = None
if "plmn_id" in ue:
active_ues[ue["rnti"]]["plmn_id"] = ue["plmn_id"]
else:
active_ues[ue["rnti"]]["plmn_id"] = None
# List of inactive UEs
if "inactive_ue_id" in ues_id_msg_repl:
for ue in ues_id_msg_repl["inactive_ue_id"]:
inactive_ues[ue["rnti"]] = {}
if "imsi" in ue:
inactive_ues[ue["rnti"]]["imsi"] = ue["imsi"]
else:
inactive_ues[ue["rnti"]]["imsi"] = None
if "plmn_id" in ue:
inactive_ues[ue["rnti"]]["plmn_id"] = ue["plmn_id"]
else:
inactive_ues[ue["rnti"]]["plmn_id"] = None
for rnti in active_ues:
ue_id = hex_to_ether(rnti)
if ue_id not in RUNTIME.ues:
ue_id = hex_to_ether(rnti)
imsi = active_ues[ue["rnti"]]["imsi"]
new_ue = UE(ue_id, imsi, self.vbs)
RUNTIME.ues[ue_id] = new_ue
ue = RUNTIME.ues[ue_id]
plmn_id = int(active_ues[rnti]["plmn_id"])
if not ue.plmn_id and plmn_id:
# setting tenant
ue.tenant = RUNTIME.load_tenant_by_plmn_id(plmn_id)
if ue.tenant:
# adding UE to tenant
LOG.info("Adding %s to tenant %s", ue.addr,
ue.tenant.plmn_id)
ue.tenant.ues[ue.addr] = ue
# Raise UE join
self.server.send_ue_join_message_to_self(ue)
if ue.plmn_id and not plmn_id:
# removing UE from tenant
LOG.info("Removing %s from tenant %s", ue.addr,
ue.tenant.plmn_id)
del ue.tenant.ues[ue.addr]
# Raise UE leave
self.server.send_ue_leave_message_to_self(ue)
# setting tenant
ue.tenant = None
existing_ues = []
existing_ues.extend(RUNTIME.ues.keys())
for ue_id in existing_ues:
if ether_to_hex(ue_id) not in active_ues:
RUNTIME.remove_ue(ue_id)