From d8c2943f60488b08bf6d91156f5c6509ff490bc2 Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Sat, 19 May 2018 18:28:48 +0200
Subject: [PATCH] FlexRAN RAN API: slice creation does not set default vals

---
 openair2/ENB_APP/flexran_agent_ran_api.c | 46 ++----------------------
 openair2/ENB_APP/flexran_agent_ran_api.h |  8 ++---
 2 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c
index 4ab5858dda..dc74652874 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.c
+++ b/openair2/ENB_APP/flexran_agent_ran_api.c
@@ -1435,35 +1435,13 @@ int flexran_dl_slice_exists(mid_t mod_id, int slice_idx)
   return slice_idx >= 0 && slice_idx < RC.mac[mod_id]->slice_info.n_dl;
 }
 
-int flexran_create_dl_slice(mid_t mod_id, slice_id_t slice_id, int slice_default_values_idx)
+int flexran_create_dl_slice(mid_t mod_id, slice_id_t slice_id)
 {
   if (!mac_is_present(mod_id)) return -1;
-  if (!flexran_dl_slice_exists(mod_id, slice_default_values_idx)) return -1;
   int newidx = RC.mac[mod_id]->slice_info.n_dl;
   if (newidx >= MAX_NUM_SLICES) return -1;
-
   ++RC.mac[mod_id]->slice_info.n_dl;
   flexran_set_dl_slice_id(mod_id, newidx, slice_id);
-  flexran_set_dl_slice_percentage(mod_id, newidx,
-      flexran_get_dl_slice_percentage(mod_id, slice_default_values_idx));
-  flexran_set_dl_slice_isolation(mod_id, newidx,
-      flexran_get_dl_slice_isolation(mod_id, slice_default_values_idx));
-  flexran_set_dl_slice_priority(mod_id, newidx,
-      flexran_get_dl_slice_priority(mod_id, slice_default_values_idx));
-  flexran_set_dl_slice_position_low(mod_id, newidx,
-      flexran_get_dl_slice_position_low(mod_id, slice_default_values_idx));
-  flexran_set_dl_slice_position_high(mod_id, newidx,
-      flexran_get_dl_slice_position_high(mod_id, slice_default_values_idx));
-  flexran_set_dl_slice_maxmcs(mod_id, newidx,
-      flexran_get_dl_slice_maxmcs(mod_id, slice_default_values_idx));
-  Protocol__FlexDlSorting *sorting = NULL;
-  int n = flexran_get_dl_slice_sorting(mod_id, slice_default_values_idx, &sorting);
-  flexran_set_dl_slice_sorting(mod_id, newidx, sorting, n);
-  free(sorting);
-  flexran_set_dl_slice_accounting_policy(mod_id, newidx,
-      flexran_get_dl_slice_accounting_policy(mod_id, slice_default_values_idx));
-  flexran_set_dl_slice_scheduler_name(mod_id, newidx,
-      flexran_get_dl_slice_scheduler_name(mod_id, slice_default_values_idx));
   return newidx;
 }
 
@@ -1716,33 +1694,13 @@ int flexran_set_dl_slice_scheduler(mid_t mod_id, int slice_idx, char *name)
   return RC.mac[mod_id]->slice_info.dl[slice_idx].sched_cb != NULL;
 }
 
-int flexran_create_ul_slice(mid_t mod_id, slice_id_t slice_id, int slice_default_values_idx)
+int flexran_create_ul_slice(mid_t mod_id, slice_id_t slice_id)
 {
   if (!mac_is_present(mod_id)) return -1;
-  if (!flexran_ul_slice_exists(mod_id, slice_default_values_idx)) return -1;
   int newidx = RC.mac[mod_id]->slice_info.n_ul;
   if (newidx >= MAX_NUM_SLICES) return -1;
-
   ++RC.mac[mod_id]->slice_info.n_ul;
   flexran_set_ul_slice_id(mod_id, newidx, slice_id);
-  flexran_set_ul_slice_percentage(mod_id, newidx,
-      flexran_get_ul_slice_percentage(mod_id, slice_default_values_idx));
-  /*flexran_set_ul_slice_isolation(mod_id, newidx,
-      flexran_get_ul_slice_isolation(mod_id, slice_default_values_idx));
-  flexran_set_ul_slice_priority(mod_id, newidx,
-      flexran_get_ul_slice_priority(mod_id, slice_default_values_idx));*/
-  flexran_set_ul_slice_first_rb(mod_id, newidx,
-      flexran_get_ul_slice_first_rb(mod_id, slice_default_values_idx));
-  flexran_set_ul_slice_maxmcs(mod_id, newidx,
-      flexran_get_ul_slice_maxmcs(mod_id, slice_default_values_idx));
-  /*Protocol__FlexUlSorting *sorting = NULL;
-  int n = flexran_get_ul_slice_sorting(mod_id, slice_default_values_idx, &sorting);
-  flexran_set_ul_slice_sorting(mod_id, newidx, sorting, n);
-  free(sorting);*/
-  /*flexran_set_ul_slice_accounting_policy(mod_id, newidx,
-      flexran_get_ul_slice_accounting_policy(mod_id, slice_default_values_idx));*/
-  flexran_set_ul_slice_scheduler_name(mod_id, newidx,
-      flexran_get_ul_slice_scheduler_name(mod_id, slice_default_values_idx));
   return newidx;
 }
 
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h
index a959c4fd50..d64d5806e6 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.h
+++ b/openair2/ENB_APP/flexran_agent_ran_api.h
@@ -535,8 +535,8 @@ int flexran_get_num_dl_slices(mid_t mod_id);
 /* Query slice existence in DL. Return is boolean value */
 int flexran_dl_slice_exists(mid_t mod_id, int slice_idx);
 
-/* Create slice in DL with values from another slice, returns the new slice index */
-int flexran_create_dl_slice(mid_t mod_id, slice_id_t slice_id, int slice_default_values_idx);
+/* Create slice in DL, returns the new slice index */
+int flexran_create_dl_slice(mid_t mod_id, slice_id_t slice_id);
 /* Finds slice in DL with given slice_id and returns slice index */
 int flexran_find_dl_slice(mid_t mod_id, slice_id_t slice_id);
 /* Remove slice in DL, returns new number of slices or -1 on error */
@@ -599,8 +599,8 @@ int flexran_get_num_ul_slices(mid_t mod_id);
 /* Query slice existence in UL. Return is boolean value */
 int flexran_ul_slice_exists(mid_t mod_id, int slice_idx);
 
-/* Create slice in UL with values from another slice, returns the new slice index */
-int flexran_create_ul_slice(mid_t mod_id, slice_id_t slice_id, int slice_default_values_idx);
+/* Create slice in UL, returns the new slice index */
+int flexran_create_ul_slice(mid_t mod_id, slice_id_t slice_id);
 /* Finds slice in UL with given slice_id and returns slice index */
 int flexran_find_ul_slice(mid_t mod_id, slice_id_t slice_id);
 /* Remove slice in UL */
-- 
GitLab