-
Notifications
You must be signed in to change notification settings - Fork 0
Resource Management Algorithm Interface
Manuel Peuster edited this page Jul 28, 2014
·
2 revisions
class SimpleNearestApAlgorithm(base.BaseAlgorithm):
def __init__(self):
"""
Some initialization work.
"""
pass
def compute(self, ue_list, ap_list, requesting_ue):
"""
Computes the assignment of UE to APs and power state for the APs.
Input:
- list of UE dicts (structured like REST API JSON return)
- list of AP dicts (structured like REST API JSON return)
- uuid of UE which has triggered this algorithm run
Result:
Tuple(power_states_dict, assignment_dict)
- power_states_dict: AP uuid -> power state (True/False)
e.g. {"ap_uuid": True, "ap_uuid2": False}
- assignment_dict: UE uuid -> AP uuid / None
e.g. {"ue_uuid1": "ap_uuid2", "ue_uuid2": None}
"""
# TODO: Implement real algorithm
logging.info("Running SimpleNearestApAlgorithm...")
power_states_dict = {}
assignment_dict = {}
# switch on all APs
for ap in ap_list:
power_states_dict[ap["uuid"]] = True
# assign ap1 to all UE
for ue in ue_list:
if len(ap_list) > 0:
assignment_dict[ue["uuid"]] = ap_list[0]["uuid"]
return (power_states_dict, assignment_dict)