Add R5 content to master
[ric-plt/e2mgr.git] / Automation / Tests / Resource / Keywords.robot
old mode 100755 (executable)
new mode 100644 (file)
index e1d6e63..1f453df
 #   limitations under the License.
 #
 ##############################################################################
+#
+#   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+#   platform project (RICP).
+#
 
 *** Settings ***
 Documentation   Keywords file
@@ -22,66 +26,67 @@ Library     ../Scripts/cleanup_db.py
 Resource   ../Resource/resource.robot
 Library     OperatingSystem
 
-
-
-
-
 *** Keywords ***
-Post Request setup node b x-2
-    Set Headers     ${header}
-    POST        /v1/nodeb/x2-setup    ${json}
-
-
-
-Get Request node b enb test1
+Get Request node b gnb
     Sleep    1s
-    GET      /v1/nodeb/test1
+    GET      ${getNodeb}
 
+Update Ran request
+    Sleep  1s
+    PUT    ${update_gnb_url}   ${update_gnb_body}
 
-Get Request node b enb test2
-    Sleep    1s
-    GET      /v1/nodeb/test2
+Set General Configuration request
+    Sleep  1s
+    PUT    ${set_general_configuration}   ${set_general_configuration_body}
 
+Update Ran request not valid
+    Sleep  1s
+    PUT    ${update_gnb_url}   ${update_gnb_body_notvalid}
 
 Remove log files
     Remove File  ${EXECDIR}/${gnb_log_filename}
     Remove File  ${EXECDIR}/${e2mgr_log_filename}
-    Remove File  ${EXECDIR}/${rsm_log_filename}
-    Remove File  ${EXECDIR}/${e2adapter_log_filename}
+    Remove File  ${EXECDIR}/${e2t_log_filename}
+    Remove File  ${EXECDIR}/${rm_sim_log_filename}
 
 Save logs
     Sleep   1s
     Run     ${Save_sim_log}
     Run     ${Save_e2mgr_log}
-    Run     ${Save_rsm_log}
-    Run     ${Save_e2adapter_log}
-
-
-Post Request setup node b endc-setup
-    Set Headers     ${header}
-    POST        /v1/nodeb/endc-setup    ${endcjson}
+    Run     ${Save_e2t_log}
+    Run     ${Save_rm_sim_log}
 
 Stop Simulator
     Run And Return Rc And Output    ${stop_simu}
 
-
-Prepare Simulator For Load Information
-     Run And Return Rc And Output    ${stop_simu}
-     Run And Return Rc And Output    ${docker_Remove}
-     ${flush}  cleanup_db.flush
-     Should Be Equal As Strings  ${flush}  True
-     Run And Return Rc And Output    ${run_simu_load}
-     ${result}=  Run And Return Rc And Output     ${docker_command}
-     Should Be Equal As Integers    ${result[1]}    ${docker_number}
-
 Prepare Enviorment
+     Log To Console  Starting preparations
+     ${starting_timestamp}    Evaluate   datetime.datetime.now(datetime.timezone.utc).isoformat("T")   modules=datetime 
+     ${e2t_log_filename}      Evaluate      "e2t.${SUITE NAME}.log".replace(" ","-")
+     ${e2mgr_log_filename}    Evaluate      "e2mgr.${SUITE NAME}.log".replace(" ","-")
+     ${gnb_log_filename}      Evaluate      "gnb.${SUITE NAME}.log".replace(" ","-")
+     ${rm_sim_log_filename}   Evaluate      "rm_sim.${SUITE NAME}.log".replace(" ","-")
+     ${Save_sim_log}          Evaluate   'docker logs --since ${starting_timestamp} gnbe2_oran_simu > ${gnb_log_filename}'
+     ${Save_e2mgr_log}        Evaluate   'docker logs --since ${starting_timestamp} e2mgr > ${e2mgr_log_filename}'
+     ${Save_e2t_log}          Evaluate   'docker logs --since ${starting_timestamp} e2 > ${e2t_log_filename}'
+     ${Save_rm_sim_log}       Evaluate   'docker logs --since ${starting_timestamp} rm_sim > ${rm_sim_log_filename}'
+     Set Suite Variable  ${e2t_log_filename}
+     Set Suite Variable  ${e2mgr_log_filename}  
+     Set Suite Variable  ${gnb_log_filename}   
+     Set Suite Variable  ${rm_sim_log_filename}
+     Set Suite Variable  ${Save_sim_log}
+     Set Suite Variable  ${Save_e2mgr_log}
+     Set Suite Variable  ${Save_e2t_log}
+     Set Suite Variable  ${Save_rm_sim_log}
+
+        Log To Console  Ready to flush db
      ${flush}  cleanup_db.flush
      Should Be Equal As Strings  ${flush}  True
      Run And Return Rc And Output    ${stop_simu}
      Run And Return Rc And Output    ${docker_Remove}
      Run And Return Rc And Output    ${run_simu_regular}
-     Run And Return Rc And Output    ${restart_e2adapter}
-     Sleep  2s
+     Sleep  3s
+     Log To Console  Validating dockers are up
      ${result}=  Run And Return Rc And Output     ${docker_command}
      Should Be Equal As Integers    ${result[1]}    ${docker_number}
 
@@ -91,6 +96,12 @@ Start E2
      Should Be Equal As Integers    ${result[1]}    ${docker_number}
      Sleep  2s
 
+Stop E2
+     Run And Return Rc And Output    ${stop_e2}
+     ${result}=  Run And Return Rc And Output     ${docker_command}
+     Should Be Equal As Integers    ${result[1]}    ${docker_number-1}
+     Sleep  2s
+
 Start Dbass
      Run And Return Rc And Output    ${dbass_remove}
      Run And Return Rc And Output    ${dbass_start}
@@ -102,7 +113,23 @@ Stop Dbass
      ${result}=  Run And Return Rc And Output     ${docker_command}
      Should Be Equal As Integers    ${result[1]}    ${docker_number-1}
 
+Restart simulator
+    Run And Return Rc And Output    ${restart_simu}
+    ${result}=  Run And Return Rc And Output     ${docker_command}
+    Should Be Equal As Integers    ${result[1]}    ${docker_number}
+
+Start RoutingManager Simulator
+    Run And Return Rc And Output    ${start_routingmanager_sim}
 
+Stop RoutingManager Simulator
+    Run And Return Rc And Output    ${stop_routingmanager_sim}
 
+Restart simulator with less docker
+    Run And Return Rc And Output    ${restart_simu}
+    ${result}=  Run And Return Rc And Output     ${docker_command}
+    Should Be Equal As Integers    ${result[1]}    ${docker_number-1}
 
+Flush And Populate DB
+    ${flush}  cleanup_db.flush
+    Sleep  2s