From 83602d0da73c3df58d05ef9e26c5a398d142fb8c Mon Sep 17 00:00:00 2001 From: reinaortega <miguelangel.reinaortega@etsi.org> Date: Fri, 7 Sep 2018 12:04:39 +0200 Subject: [PATCH] Improvement on f_getYear and f_getMonth functions Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org> --- LibOneM2M/OneM2M_Functions.ttcn | 8 ++++---- OneM2M_PermutationFunctions.ttcn | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 0bcd277..67bfdaf 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -3459,7 +3459,7 @@ module OneM2M_Functions { * @param p_timestamp Given timestamp * @return Year */ - function f_getYear(charstring p_timestamp) runs on Tester return charstring { + function f_getYear(charstring p_timestamp) runs on Tester return integer { var charstring v_year := ""; var integer i; @@ -3467,7 +3467,7 @@ module OneM2M_Functions { for(i := 0; i <= 3; i := i+1){ v_year := v_year & p_timestamp[i]; } - return v_year; + return str2int(v_year); } // end f_getYear @@ -3476,7 +3476,7 @@ module OneM2M_Functions { * @param p_timestamp Given timestamp * @return Year */ - function f_getMonth(charstring p_timestamp) runs on Tester return charstring { + function f_getMonth(charstring p_timestamp) runs on Tester return integer { var charstring v_month := ""; var integer i; @@ -3486,7 +3486,7 @@ module OneM2M_Functions { v_month := v_month & p_timestamp[i]; } } - return v_month; + return str2int(v_month); } // end f_getYear diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 088debd..b42f331 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -5844,7 +5844,7 @@ module OneM2M_PermutationFunctions { // Preamble v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1); v_currentTime := fx_generateTimestamp(); - v_accessControlRule.accessControlContexts_list := {{{"* * * * " & f_getMonth(v_currentTime) & " *"}, omit, omit}}; + v_accessControlRule.accessControlContexts_list := {{{"* * * * " & int2str(f_getMonth(v_currentTime)) & " *"}, omit, omit}}; v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule}; vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource @@ -5892,7 +5892,7 @@ module OneM2M_PermutationFunctions { function f_CSE_SEC_ACP_006(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{ // Local variables var MsgIn v_response; - var charstring v_month; + var integer v_month; var charstring v_currentTime; var integer v_aeIndex := -1; var RequestPrimitive v_createRequest; @@ -5909,12 +5909,12 @@ module OneM2M_PermutationFunctions { v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1); v_currentTime := fx_generateTimestamp(); v_month := f_getMonth(v_currentTime); - if(v_month =="12") { - v_month := "1"; + if(v_month == 12) { + v_month := 1; } else { - v_month := int2char(char2int(v_month) + 1); + v_month := v_month + 1; } - v_accessControlRule.accessControlContexts_list := {{{"* * * * " & v_month & " *"}, omit, omit}}; + v_accessControlRule.accessControlContexts_list := {{{"* * * * " & int2str(v_month) & " *"}, omit, omit}}; v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule}; vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource -- GitLab