RIC-11565:Add support for Multiple E2 Nodes: CU/DU for the case having same GNBId
[ric-plt/e2mgr.git] / Automation / Tests / Resource / Keywords.robot
index 6d1fdd8..f252af8 100644 (file)
@@ -1,6 +1,7 @@
 ##############################################################################
 #
 #   Copyright (c) 2019 AT&T Intellectual Property.
+#   Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -29,30 +30,41 @@ Library     OperatingSystem
 Library     Process
 Variables  ../Scripts/variables.py
 
-*** Variables ***
-${e2adapter}  ${e2adapter_pod_name}
-
 *** Keywords ***
 Get Request nodeb
     [Arguments]    ${nodeb_name}=${ranName}
     Sleep    1s
     GET      ${getNodeb}/${nodeb_name}
 
+Get request nodeb health
+    [Arguments]    ${request_body}=${list_nodeb_body}
+    Sleep    1s
+    LOG      health check url ${nodeb_health_url}
+    LOG      health check body ${request_body}
+    PUT      ${nodeb_health_url}    ${request_body}
+
 Update Gnb request
     Sleep  1s
     PUT    ${update_gnb_url}   ${update_gnb_body}
 
 Add eNb Request
+    [Arguments]    ${request}=${add_enb_request_body}
+    Sleep  1s
+    POST    ${enb_url}   ${request}
+
+Get NodeB state request
+    [Arguments]     ${request}=${nodeb_state_url}
     Sleep  1s
-    POST    ${enb_url}   ${add_enb_request_body}
+    GET    ${request}
 
 Delete eNb Request
     Sleep  1s
     DELETE    ${enb_url}/${enb_ran_name}
 
 Update eNb Request
+    [Arguments]    ${request}=${update_enb_request_body}
     Sleep  1s
-    PUT    ${enb_url}/${enb_ran_name}   ${update_enb_request_body}
+    PUT    ${enb_url}/${enb_ran_name}   ${request}
 
 Set General Configuration request
     Sleep  1s
@@ -174,7 +186,12 @@ Start e2adapter
 Stop e2adapter
      Log to Console  Stopping e2adapter
      Run And Return Rc And Output    ${stop_e2adapter}
-     Sleep  5s
+     Sleep  90s
+
+Restart e2adapter
+    Log to Console  Restarting e2adapter
+    Stop e2adapter
+    Start e2adapter
 
 Flush And Populate DB
     [Arguments]    ${set_new_timestamp}=${True}
@@ -192,8 +209,10 @@ Stop All Pods Except Simulator
 
 Send eNB Setup Request
     Log To Console  Sending eNB setup request form e2adapter
-    ${send_enb_setup}       Evaluate    "kubectl -n ricplt exec -it ${e2adapter} cli send-e2setup-req 10.0.2.15"
-    Sleep    3s
+    Restart e2adapter
+    Wait until keyword succeeds  2 min    3 sec    Validate Required Dockers
+    ${e2adapter_pod} =    Run And Return Rc And Output   kubectl get pods -n ricplt | /bin/grep e2adapter | /bin/grep Running | awk '{{print $1}}'
+    ${send_enb_setup}    Evaluate    "kubectl -n ricplt exec -it ${e2adapter_pod[1]} cli send-e2setup-req 10.0.2.15"
     Run And Return Rc And Output    ${send_enb_setup}
 
 Start Redis Monitor