def get_object_params_to_get( desired_cfg: Optional[EnodebConfiguration], device_cfg: EnodebConfiguration, data_model: DataModel, request_all_params: bool = False, ) -> List[ParameterName]: """ Returns a list of parameter names for object parameters we don't know the current value of If `request_all_params` is set to True, the function will return a list of all device model param names, including already known ones. """ names = [] # TODO: This might a string for some strange reason, investigate why num_plmns = \ int(device_cfg.get_parameter(ParameterName.NUM_PLMNS)) for i in range(1, num_plmns + 1): obj_name = ParameterName.PLMN_N % i if not device_cfg.has_object(obj_name): device_cfg.add_object(obj_name) obj_to_params = data_model.get_numbered_param_names() desired = obj_to_params[obj_name] if request_all_params: names += desired else: current = [] if desired_cfg is not None: current = desired_cfg.get_parameter_names_for_object(obj_name) names_to_add = list(set(desired) - set(current)) names += names_to_add return names
def get_object_params_to_get( desired_cfg: Optional[EnodebConfiguration], device_cfg: EnodebConfiguration, data_model: DataModel, ) -> List[ParameterName]: """ Returns a list of parameter names for object parameters we don't know the current value of """ names = [] # TODO: This might a string for some strange reason, investigate why num_plmns = \ int(device_cfg.get_parameter(ParameterName.NUM_PLMNS)) for i in range(1, num_plmns + 1): obj_name = ParameterName.PLMN_N % i if not device_cfg.has_object(obj_name): device_cfg.add_object(obj_name) obj_to_params = data_model.get_numbered_param_names() desired = obj_to_params[obj_name] current = [] if desired_cfg is not None: current = desired_cfg.get_parameter_names_for_object(obj_name) names_to_add = list(set(desired) - set(current)) names = names + names_to_add return names
def get_params_to_get( self, data_model: DataModel, ) -> List[ParameterName]: names = [] # First get base params names = get_params_to_get( self.acs.device_cfg, self.acs.data_model, request_all_params=True, ) # Add object params. num_plmns = data_model.get_num_plmns() obj_to_params = data_model.get_numbered_param_names() for i in range(1, num_plmns + 1): obj_name = ParameterName.PLMN_N % i desired = obj_to_params[obj_name] names += desired return names
def _get_object_params_to_get( device_cfg: EnodebConfiguration, data_model: DataModel, ) -> List[ParameterName]: """ Returns a list of parameter names for object parameters we don't know the current value of. Since there is no parameter for tracking the number of PLMNs, then we make the assumption that if any PLMN object exists, then we've already fetched the object parameter values. """ if device_cfg.has_object(ParameterName.PLMN_N % 1): return [] names = [] num_plmns = data_model.get_num_plmns() obj_to_params = data_model.get_numbered_param_names() for i in range(1, num_plmns + 1): obj_name = ParameterName.PLMN_N % i desired = obj_to_params[obj_name] names = names + desired return names