[RIC-573] Refactoring automation in order to support K8S environment 88/4388/1
authorss412g <shuky.har-noy@intl.att.com>
Tue, 14 Jul 2020 21:54:24 +0000 (21:54 +0000)
committerss412g <shuky.har-noy@intl.att.com>
Tue, 14 Jul 2020 21:55:06 +0000 (21:55 +0000)
Change-Id: Id13aecfb20e736937782f9d2c7eb89655cf4e9bc
Signed-off-by: ss412g <shuky.har-noy@intl.att.com>
40 files changed:
Automation/FAILED_TESTS/Reset_unhappy.robot
Automation/Tests/A_Init/Init.robot [moved from Automation/Tests/Resource/scripts_variables.robot with 51% similarity]
Automation/Tests/A_Init/__init__.robot [new file with mode: 0644]
Automation/Tests/E2Term_Initialization/E2Term_Init_Message_Test.robot
Automation/Tests/E2_Setup_Failure/Enable_Ric_False_Setup_Failure.robot
Automation/Tests/E2_Setup_Failure/RM_Error_Setup_Failure.robot
Automation/Tests/Get-All-Nodes-Real/Get_all_nodes_run_setup_and_get_all.robot
Automation/Tests/Get-All-Nodes/Get_nodes_Add_nodes_and_get.robot
Automation/Tests/GetNodeB-GNB/GetNodeB-GNB_test.robot
Automation/Tests/Get_E2T_Instances/get_e2t_instances.robot
Automation/Tests/Health/get_health_check.robot
Automation/Tests/Health/get_health_check_unhappy.robot
Automation/Tests/KeepAlive/keep_alive_test.robot
Automation/Tests/Lost_Connection/LostConnectionTestConnectedRan.robot
Automation/Tests/RedButton/RedButton_CONNECTED.robot
Automation/Tests/RedButton/RedButton_CONNECTED_SHUTDOWN_CONNECTED.robot
Automation/Tests/RedButton/RedButton_SHUTDOWN_SHUTDOWN.robot
Automation/Tests/RedButton/red_button_keywords.robot
Automation/Tests/Resource/Keywords.robot
Automation/Tests/Resource/resource.robot
Automation/Tests/Scripts/cleanup_db.py
Automation/Tests/Scripts/config.py
Automation/Tests/Scripts/e2mdbscripts.py
Automation/Tests/Scripts/e2t_db_script.py [deleted file]
Automation/Tests/Scripts/getnodes.py
Automation/Tests/Scripts/k8s_helper.py [new file with mode: 0644]
Automation/Tests/Scripts/variables.py [new file with mode: 0644]
Automation/Tests/SetGeneralConfiguration/set_general_configuration.robot
Automation/Tests/Setup_Failure/Setup_failure.robot
Automation/Tests/Unhappy/Get_All_Nodedb_HttpResponse500.robot
Automation/Tests/Unhappy/Get_Nodeb_HttpResponse404.robot
Automation/Tests/Unhappy/Get_Nodeb_HttpResponse500.robot
Automation/Tests/Unhappy/RedButton_HttpResponse500.robot
Automation/Tests/Update_GNB/Update_gnb_Unhappy.robot [moved from Automation/Tests/Update_Ran/Update_ran_Unhappy.robot with 91% similarity]
Automation/Tests/Update_GNB/Update_gnb_happy.robot [moved from Automation/Tests/Update_Ran/Update_ran_happy.robot with 92% similarity]
Automation/Tests/Update_GNB/__init__.robot [moved from Automation/Tests/Update_Ran/__init__.robot with 100% similarity]
Automation/deprecated/Unhappy/Reset_HttpResponse400_wrongstate.robot
Automation/deprecated/Unhappy/Setup_Request_HttpResponse503.robot
Automation/deprecated/X2_Reset_RAN_TO_RIC_Unhappy/Reset_RNIB.robot
E2Manager/e2mgr-sonar-scanner.properties

index d173919..5856d6d 100644 (file)
@@ -31,10 +31,8 @@ Suite Teardown   Start E2
 *** Test Cases ***
 
 Pre Condition for Connecting - no E2
-    Run And Return Rc And Output    ${stop_docker_e2}
-    ${result}=  Run And Return Rc And Output     ${docker_command}
-    Should Be Equal As Integers    ${result[1]}    4
-
+    Stop E2
+    wait until keyword succeeds  1 min    10 sec    Validate Required Dockers    ${pods_number-1}
 
 Prepare Ran in Connecting connectionStatus
     Sleep  1s
similarity index 51%
rename from Automation/Tests/Resource/scripts_variables.robot
rename to Automation/Tests/A_Init/Init.robot
index 5ddb394..db8e2c0 100644 (file)
 #   platform project (RICP).
 #
 
+
 *** Settings ***
-Documentation    Message types resource file
+Resource   ../Resource/resource.robot
+Resource   ../Resource/Keywords.robot
+
+*** Test Cases ***
+
+Init Environment And Validate
+    Stop All Pods Except Simulator
+    Restart simulator
+    Wait until keyword succeeds  1 min    10 sec    Validate Required Dockers    1
+
+    Start E2 Manager
+    Start Dbass
+    Wait until keyword succeeds  1 min    10 sec    Validate Required Dockers    3
+
+    Start Routing Manager
+    Wait until keyword succeeds  1 min    10 sec    Validate Required Dockers    4
+
+    Start E2
+    Wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
+
+
 
 
-*** Variables ***
 
-${E2_INIT_message_type}    MType: 1100
-${Setup_failure_message_type}    MType: 12003
-${first_retry_to_retrieve_from_db}      RnibDataService.retry - retrying 1 GetNodeb
-${third_retry_to_retrieve_from_db}      RnibDataService.retry - after 3 attempts of GetNodeb
-${RIC_RES_STATUS_REQ_message_type_successfully_sent}     Message type: 10090 - Successfully sent RMR message
-${E2_TERM_KEEP_ALIVE_REQ_message_type_successfully_sent}     Message type: 1101 - Successfully sent RMR message
-${save_general_configuration}      SetGeneralConfigurationHandler.Handle - save general configuration to rnib: {EnableRic:false}
-${set_and_publish_disconnect}      RnibDataService.UpdateNodebInfoOnConnectionStatusInversion - stateChangeMessageChannel: RAN_CONNECTION_STATUS_CHANGE, event: gnb_208_092_303030_DISCONNECTED
\ No newline at end of file
diff --git a/Automation/Tests/A_Init/__init__.robot b/Automation/Tests/A_Init/__init__.robot
new file mode 100644 (file)
index 0000000..a5289f9
--- /dev/null
@@ -0,0 +1,24 @@
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+#
+#   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+#   platform project (RICP).
+#
+
+*** Settings ***
+Documentation    Init
index 1351df7..692e2ed 100644 (file)
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
-Resource    ../Resource/scripts_variables.robot
 Library     OperatingSystem
 Library     ../Scripts/find_rmr_message.py
 Library     ../Scripts/cleanup_db.py
-Library     ../Scripts/e2t_db_script.py
+Library     ../Scripts/e2mdbscripts.py
 
 *** Test Cases ***
 
 Test New E2T Send Init
     Stop E2
-    ${result}=    cleanup_db.flush
-    Should Be Equal As Strings  ${result}    True
+    Stop Routing Manager
+    Flush And Populate DB
+    Start Routing Manager
+    wait until keyword succeeds  1 min    10 sec    Validate Required Dockers    ${pods_number-1}
     Start E2
+    wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
 
-prepare logs for tests
+Prepare Logs For Tests
     Remove log files
     Save logs
 
@@ -47,10 +49,10 @@ E2M Logs - Verify RMR Message
     Should Be Equal As Strings    ${result}      True
 
 Verify E2T keys in DB
-    ${result}=    e2t_db_script.verify_e2t_addresses_key
+    ${result}=    e2mdbscripts.verify_e2t_addresses_for_e2t_initialization_tc
     Should Be Equal As Strings  ${result}    True
 
-    ${result}=    e2t_db_script.verify_e2t_instance_key
+    ${result}=    e2mdbscripts.verify_e2t_instance_for_e2t_initialization_tc
     Should Be Equal As Strings  ${result}    True
 
 
index acada18..76c36e0 100644 (file)
 
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
-Resource    ../Resource/scripts_variables.robot
 Library     OperatingSystem
 Library     ../Scripts/find_rmr_message.py
 Library     ../Scripts/e2mdbscripts.py
 Library     REST        ${url}
 Suite Teardown  Flush And Populate DB
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 
 Disable ric and restart simulator
     ${result}    e2mdbscripts.set_enable_ric_false
     Restart simulator
-
+    wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
 
 prepare logs for tests
     Remove log files
     Save logs
 
-
 E2M Logs - Verify RMR Message
     ${result}    find_rmr_message.verify_logs   ${EXECDIR}   ${e2mgr_log_filename}  ${Setup_failure_message_type}    ${None}
     Should Be Equal As Strings    ${result}      True
\ No newline at end of file
index aca558f..883ef98 100644 (file)
 
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
-Resource    ../Resource/scripts_variables.robot
 Library     OperatingSystem
 Library     ../Scripts/find_rmr_message.py
 Library     REST        ${url}
-Suite Teardown  Start RoutingManager Simulator
+
+*** Variables ***
+${url}  ${e2mgr_address}
 
 
 *** Test Cases ***
-Stop Routing manager simulator and restarting simulator
-    Stop RoutingManager Simulator
-    Restart simulator with less docker
+Stop routing manager and restarting gnb simulator
+    Stop Routing Manager
+    Restart simulator
+    wait until keyword succeeds  1 min    10 sec    Validate Required Dockers    ${pods_number-1}
 
 prepare logs for tests
     Remove log files
@@ -57,4 +60,8 @@ Get request gnb
 
 E2M Logs - Verify RMR Message
     ${result}    find_rmr_message.verify_logs   ${EXECDIR}   ${e2mgr_log_filename}  ${Setup_failure_message_type}    ${None}
-    Should Be Equal As Strings    ${result}      True
\ No newline at end of file
+    Should Be Equal As Strings    ${result}      True
+
+
+              Start Routing Manager
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
\ No newline at end of file
index ac8f70a..0b83605 100644 (file)
 #
 
 *** Settings ***
-Suite Setup  Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment     ${True}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
 Library     OperatingSystem
 Library     REST      ${url}
 
-
-*** Test Cases ***
+*** Variables ***
+${url}  ${e2mgr_address}
 
 
+*** Test Cases ***
 
 Get all node ids
     GET     v1/nodeb/ids
@@ -40,8 +42,9 @@ Get all node ids
     String   response body 0 globalNbId plmnId   02F829
     String   response body 0 globalNbId nbId     001100000011000000110000
 
-
-
+Prepare Logs For Tests
+    Remove log files
+    Save logs
 
 
 
index 9b249b1..5bddb5a 100644 (file)
@@ -21,6 +21,7 @@
 #
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Library      Process
 Library     ../Scripts/getnodes.py
@@ -29,11 +30,13 @@ Resource   ../Resource/Keywords.robot
 Library     OperatingSystem
 Library     REST      ${url}
 
-
+*** Variables ***
+${url}  ${e2mgr_address}
 
 
 *** Test Cases ***
 Add nodes to redis db
+    Flush And Populate DB
     ${result}   getnodes.add
     Should Be Equal As Strings  ${result}  True
 
@@ -49,7 +52,9 @@ Get all node ids
     String   response body 1 globalNbId nbId     001234
 
 
-
+Prepare Logs For Tests
+    Remove log files
+    Save logs
 
 
 
index ac39305..26a21ed 100644 (file)
 
 
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment    ${True}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
-Resource    ../Resource/scripts_variables.robot
 Library     OperatingSystem
 Library     ../Scripts/find_rmr_message.py
 Library     ../Scripts/rsmscripts.py
 Library     REST        ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
+
 
 
 
@@ -44,7 +47,7 @@ Get request gnb
     String   response body ranName    ${ranname}
     String   response body connectionStatus    CONNECTED
     String   response body nodeType     GNB
-    String   response body associatedE2tInstanceAddress  ${e2tinstanceaddress}
+    String   response body associatedE2tInstanceAddress  ${e2t_alpha_address}
     Integer  response body gnb ranFunctions 0 ranFunctionId  1
     Integer  response body gnb ranFunctions 0 ranFunctionRevision  1
     Integer  response body gnb ranFunctions 1 ranFunctionId  2
@@ -53,6 +56,7 @@ Get request gnb
     Integer  response body gnb ranFunctions 2 ranFunctionRevision  1
 
 
-
-
+Prepare Logs For Tests
+    Remove log files
+    Save logs
 
index 4f580c0..c77dc60 100644 (file)
 ##############################################################################
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
-Resource    ../Resource/scripts_variables.robot
 Library     REST      ${url}
 Library    RequestsLibrary
 Library    Collections
@@ -28,17 +28,24 @@ Library    OperatingSystem
 Library    json
 Library     ../Scripts/e2mdbscripts.py
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 
 Get E2T instances
+    Flush And Populate DB
     ${result}    e2mdbscripts.populate_e2t_instances_in_e2m_db_for_get_e2t_instances_tc
     Create Session  getE2tInstances  ${url}
     ${headers}=  Create Dictionary    Accept=application/json
     ${resp}=    Get Request   getE2tInstances     /v1/e2t/list    headers=${headers}
     Should Be Equal As Strings   ${resp.status_code}    200
     Should Be Equal As Strings    ${resp.content}        [{"e2tAddress":"e2t.att.com:38000","ranNames":["test1","test2","test3"]}]
-    ${flush}  cleanup_db.flush
+    Flush And Populate DB
+
+Prepare Logs For Tests
+    Remove log files
+    Save logs
 
 
 
index 5dc757c..635343a 100644 (file)
 #
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
 Library     OperatingSystem
 Library     REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 
 *** Test Cases ***
@@ -34,4 +37,7 @@ Get Health
     GET     /v1/health
     Integer     response status       200
 
+Prepare logs
+    Remove log files
+    Save logs
 
index 06b4ba4..7222889 100644 (file)
 #
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
 Library     OperatingSystem
 Library     REST      ${url}
-Suite Teardown   Start Dbass
-
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 Get Health Unhappy - Dbass down
     Stop Dbass
+
     GET     /v1/health
     Integer     response status       500
 
+Prepare logs
+    Remove log files
+    Save logs
+
+[Teardown]    Run Keywords
+              Start Dbass
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
+
 
 
index 89e1b87..832e8ff 100644 (file)
@@ -16,10 +16,10 @@ robot###########################################################################
 #
 ##############################################################################
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment    ${True}    ${False}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
-Resource   ../Resource/scripts_variables.robot
 Library    ../Scripts/find_error_script.py
 Library     ../Scripts/find_rmr_message.py
 Library     ../Scripts/rsmscripts.py
@@ -28,6 +28,8 @@ Library    OperatingSystem
 Library    Collections
 Library     REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 
@@ -38,7 +40,7 @@ Get request gnb
     String   response body ranName    ${ranname}
     String   response body connectionStatus    CONNECTED
     String   response body nodeType     GNB
-    String   response body associatedE2tInstanceAddress  ${e2tinstanceaddress}
+    String   response body associatedE2tInstanceAddress  ${e2t_alpha_address}
     Integer  response body gnb ranFunctions 0 ranFunctionId  1
     Integer  response body gnb ranFunctions 0 ranFunctionRevision  1
     Integer  response body gnb ranFunctions 1 ranFunctionId  2
@@ -52,18 +54,18 @@ prepare logs for tests
     Save logs
 
 Verify RAN is associated with E2T instance
-   ${result}    e2mdbscripts.verify_ran_is_associated_with_e2t_instance      ${ranname}    ${e2tinstanceaddress}
+   ${result}    e2mdbscripts.verify_ran_is_associated_with_e2t_instance      ${ranname}    ${e2t_alpha_address}
    Should Be True    ${result}
 
 Stop E2T
     Stop E2
-    Sleep  3s
 
 Prepare logs
     Remove log files
     Save logs
 
 Verify RAN is not associated with E2T instance
+    Sleep  6m
     Get Request node b gnb
     Integer  response status  200
     String   response body ranName    ${ranname}
@@ -71,11 +73,13 @@ Verify RAN is not associated with E2T instance
     String   response body connectionStatus    DISCONNECTED
 
 Verify E2T instance removed from db
-    ${result}    e2mdbscripts.verify_e2t_instance_key_exists     ${e2tinstanceaddress}
+    ${result}    e2mdbscripts.verify_e2t_instance_key_exists     ${e2t_alpha_address}
     Should Be True    ${result} == False
 
-    ${result}    e2mdbscripts.verify_e2t_instance_exists_in_addresses     ${e2tinstanceaddress}
+    ${result}    e2mdbscripts.verify_e2t_instance_exists_in_addresses     ${e2t_alpha_address}
     Should Be True    ${result} == False
 
-Start E2T
-    Start E2
\ No newline at end of file
+
+[Teardown]    Run Keywords
+              Start E2
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
\ No newline at end of file
index e19efed..86dd8e0 100644 (file)
 #   platform project (RICP).
 #
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment    ${True}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
-Resource   ../Resource/scripts_variables.robot
 Library    ../Scripts/find_error_script.py
 Library     ../Scripts/e2mdbscripts.py
 Library     OperatingSystem
 Library    Collections
 Library     REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 
@@ -38,13 +40,13 @@ Setup Ran and verify it's CONNECTED and associated
     Integer  response status  200
     String   response body ranName    ${ranname}
     String   response body connectionStatus    CONNECTED
-    String   response body associatedE2tInstanceAddress  ${e2tinstanceaddress}
+    String   response body associatedE2tInstanceAddress  ${e2t_alpha_address}
 
 Stop simulator
    Stop Simulator
 
 Verify connection status is DISCONNECTED and RAN is not associated with E2T instance
-    Sleep    2s
+    Sleep    30s
     GET      ${getNodeb}
     Integer  response status  200
     String   response body ranName    ${ranname}
@@ -56,9 +58,13 @@ prepare logs for tests
     Save logs
 
 Verify E2T instance is NOT associated with RAN
-   ${result}    e2mdbscripts.verify_ran_is_associated_with_e2t_instance     ${ranname}  ${e2tinstanceaddress}
+   ${result}    e2mdbscripts.verify_ran_is_associated_with_e2t_instance     ${ranname}  ${e2t_alpha_address}
    Should Be True    ${result} == False
 
-Verify e2mgr logs - Set and Publish Disconnect True
-  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
-   Should Be Equal As Strings    ${result}      True
\ No newline at end of file
+#Verify e2mgr logs - Set and Publish Disconnect True
+#  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
+#   Should Be Equal As Strings    ${result}      True
+
+[Teardown]    Run Keywords
+              Start Simulator
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
\ No newline at end of file
index 1dd345c..517a4e1 100644 (file)
 #
 
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment    ${True}
 Resource    ../Resource/resource.robot
 Resource    ../Resource/Keywords.robot
-Resource   ../Resource/scripts_variables.robot
 Resource    red_button_keywords.robot
 Library    ../Scripts/find_error_script.py
 Library     OperatingSystem
 Library     Collections
 Library     REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 
@@ -50,6 +52,6 @@ Verify nodeb's connection status is SHUT_DOWN and it's NOT associated to an e2t
 Verify E2T instance has no associated RANs
    Verify E2T instance has no associated RANs
 
-Verify e2mgr logs - Set and Publish Disconnect
-  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
-   Should Be Equal As Strings    ${result}      True
\ No newline at end of file
+#Verify e2mgr logs - Set and Publish Disconnect
+#  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
+#   Should Be Equal As Strings    ${result}      True
\ No newline at end of file
index 4637808..daff5d1 100644 (file)
 #
 
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment    ${True}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
 Resource    red_button_keywords.robot
-Resource   ../Resource/scripts_variables.robot
 Library    ../Scripts/find_error_script.py
 Library     OperatingSystem
 Library     Collections
 Library     REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
+
 *** Test Cases ***
 
 Verify gnb nodeb connection status is CONNECTED and it's associated to an e2t instance
@@ -43,9 +46,9 @@ prepare logs for tests
     Remove log files
     Save logs
 
-Verify e2mgr logs - Set and Publish Disconnect
-  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
-   Should Be Equal As Strings    ${result}      True
+#Verify e2mgr logs - Set and Publish Disconnect
+#  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
+#   Should Be Equal As Strings    ${result}      True
 
 Verify nodeb's connection status is SHUT_DOWN and it's NOT associated to an e2t instance
    Verify shutdown for gnb
@@ -53,6 +56,7 @@ Verify nodeb's connection status is SHUT_DOWN and it's NOT associated to an e2t
 
 Restart simulator
    Restart simulator
+   wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
 
-Verify gnb nodeb connection status is CONNECTED and it's associated to an e2t instance
+Verify gnb nodeb connection status is CONNECTED and it's associated to an e2t instance - checking again
    Verify connected and associated
\ No newline at end of file
index 9561973..8fc66d9 100644 (file)
 #
 
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment    ${True}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
 Resource    red_button_keywords.robot
-Resource   ../Resource/scripts_variables.robot
 Library    ../Scripts/find_error_script.py
 Library     OperatingSystem
 Library    Collections
 Library     REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
+
 *** Test Cases ***
 
 Verify nodeb connection status is CONNECTED and it's associated to an e2t instance
@@ -43,9 +46,9 @@ prepare logs for tests
     Remove log files
     Save logs
 
-Verify e2mgr logs - Set and Publish Disconnect True
-  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
-   Should Be Equal As Strings    ${result}      True
+#Verify e2mgr logs - Set and Publish Disconnect True
+#  ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}    ${set_and_publish_disconnect}
+#   Should Be Equal As Strings    ${result}      True
 
 Verify nodeb's connection status is SHUT_DOWN and it's NOT associated to an e2t instance
    Verify shutdown for gnb
index 17f7b50..23d0875 100644 (file)
@@ -17,6 +17,7 @@
 ##############################################################################
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Documentation   Keywords file
 Resource    ../Resource/resource.robot
 Resource    ../Resource/Keywords.robot
@@ -26,13 +27,16 @@ Library    OperatingSystem
 Library    json
 Library    REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
+
 *** Keywords ***
 Verify connected and associated
    Get Request node b gnb
    Integer  response status  200
    String   response body ranName   ${ranName}
    String   response body connectionStatus    CONNECTED
-   String   response body associatedE2tInstanceAddress  ${e2tinstanceaddress}
+   String   response body associatedE2tInstanceAddress  ${e2t_alpha_address}
 
 Verify shutdown for gnb
     Get Request node b gnb
@@ -42,7 +46,7 @@ Verify shutdown for gnb
     Missing  response body associatedE2tInstanceAddress
 
 Verify E2T instance has no associated RANs
-    ${result}    e2mdbscripts.verify_e2t_instance_has_no_associated_rans     ${e2tinstanceaddress}
+    ${result}    e2mdbscripts.verify_e2t_instance_has_no_associated_rans     ${e2t_alpha_address}
     Should Be True    ${result}
 
 Execute Shutdown
index 1f453df..13873a8 100644 (file)
@@ -47,89 +47,117 @@ Remove log files
     Remove File  ${EXECDIR}/${gnb_log_filename}
     Remove File  ${EXECDIR}/${e2mgr_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_e2t_log}
-    Run     ${Save_rm_sim_log}
-
-Stop Simulator
-    Run And Return Rc And Output    ${stop_simu}
 
 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}
-     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}
+     [Arguments]     ${need_to_restart_pods}=${False}     ${set_new_timestamp}=${True}
+     Init logs
+     Flush And Populate DB    ${set_new_timestamp}
+     Run keyword if  ${need_to_restart_pods}==${True}   Restart RM and GNB Simulator
+     Wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
+
+Restart RM and GNB Simulator
+    Restart routing manager
+    Wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
+    Restart simulator
+
+
+Init logs
+    ${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(" ","-")
+    ${Save_sim_log}          Evaluate  "kubectl -n ricplt logs --since-time=${starting_timestamp} $(${gnbe2_sim_pod}) > ${gnb_log_filename}"
+    ${Save_e2mgr_log}        Evaluate   "kubectl -n ricplt logs --since-time=${starting_timestamp} $(${e2mgr_pod}) > ${e2mgr_log_filename}"
+    ${Save_e2t_log}          Evaluate   "kubectl -n ricplt logs --since-time=${starting_timestamp} $(${e2term_pod}) > ${e2t_log_filename}"
+
+    Set Suite Variable  ${e2t_log_filename}
+    Set Suite Variable  ${e2mgr_log_filename}
+    Set Suite Variable  ${gnb_log_filename}
+    Set Suite Variable  ${Save_sim_log}
+    Set Suite Variable  ${Save_e2mgr_log}
+    Set Suite Variable  ${Save_e2t_log}
+
+Validate Required Dockers
+    [Arguments]    ${required_number_of_dockers}=${pods_number}
+    Log To Console  Validating all required dockers are up
+    ${result}=  Run And Return Rc And Output     ${verify_all_pods_are_ready_command}
+    Should Be Equal As Integers    ${result[1]}    ${required_number_of_dockers}
 
 Start E2
+     Log to Console  Starting E2Term
      Run And Return Rc And Output    ${start_e2}
-     ${result}=  Run And Return Rc And Output     ${docker_command}
-     Should Be Equal As Integers    ${result[1]}    ${docker_number}
-     Sleep  2s
+     Sleep  5s
 
 Stop E2
+     Log to Console  Stopping E2Term
      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
+     Sleep  5s
+
+Start E2 Manager
+     Log to Console  Starting E2Mgr
+     Run And Return Rc And Output    ${start_e2mgr}
+     Sleep  5s
+
+Stop E2 Manager
+     Log to Console  Stopping E2Mgr
+     Run And Return Rc And Output    ${stop_e2mgr}
+     Sleep  5s
 
 Start Dbass
-     Run And Return Rc And Output    ${dbass_remove}
+     Log to Console  Starting redis
      Run And Return Rc And Output    ${dbass_start}
-     ${result}=  Run And Return Rc And Output     ${docker_command}
-     Should Be Equal As Integers    ${result[1]}    ${docker_number}
+     Sleep  5s
 
 Stop Dbass
+     Log to Console  Stopping redis
      Run And Return Rc And Output    ${dbass_stop}
-     ${result}=  Run And Return Rc And Output     ${docker_command}
-     Should Be Equal As Integers    ${result[1]}    ${docker_number-1}
+     Sleep  5s
+
+Stop Simulator
+    log to console  Stopping gnbe2 simulator
+    Run And Return Rc And Output    ${stop_simu}
+    Sleep  50s
+
+Start Simulator
+    log to console  Starting gnbe2 simulator
+    Run And Return Rc And Output    ${start_simu}
 
 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}
+   Log to Console  Restarting gnbe2 simulator
+   Stop Simulator
+   Start Simulator
 
-Start RoutingManager Simulator
-    Run And Return Rc And Output    ${start_routingmanager_sim}
+Start Routing Manager
+    Log to Console  Starting routing manager
+    Run And Return Rc And Output    ${start_routing_manager}
+    Sleep  5s
 
-Stop RoutingManager Simulator
-    Run And Return Rc And Output    ${stop_routingmanager_sim}
+Stop Routing Manager
+    Log to Console  Stopping routing manager
+    Run And Return Rc And Output    ${stop_routing_manager}
+    Sleep  5s
 
-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}
+Restart Routing Manager
+    Log to Console  Restarting routing manager
+    Stop Routing Manager
+    Start Routing Manager
 
 Flush And Populate DB
-    ${flush}  cleanup_db.flush
+    [Arguments]    ${set_new_timestamp}=${True}
+    Log To Console  Flushing and populating DB
+    ${flush}=  cleanup_db.flush    ${set_new_timestamp}
     Sleep  2s
+    Should Be Equal As Strings  ${flush}  True
+
+Stop All Pods Except Simulator
+    Stop E2 Manager
+    Stop Dbass
+    Stop E2
+    Stop Routing Manager
 
index dc33988..9c1149c 100644 (file)
@@ -25,9 +25,8 @@ Documentation    Resource file
 
 
 *** Variables ***
-${docker_number}    5
-${docker_number-1}    4
-${url}   http://localhost:3800
+
+#REST
 ${ranName}  gnb_208_092_303030
 ${getNodeb}  /v1/nodeb/${ranName}
 ${set_general_configuration}   /v1/nodeb/parameters
@@ -35,23 +34,35 @@ ${set_general_configuration_body}   {"enableRic":false}
 ${update_gnb_url}   /v1/nodeb/${ranName}/update
 ${update_gnb_body}  {"servedNrCells":[{"servedNrCellInformation":{"cellId":"abcd","choiceNrMode":{"fdd":{}},"nrMode":1,"nrPci":1,"servedPlmns":["whatever"]},"nrNeighbourInfos":[{"nrCgi":"one","choiceNrMode":{"fdd":{}},"nrMode":1,"nrPci":1}]}]}
 ${update_gnb_body_notvalid}  {"servedNrCells":[{"servedNrCellInformation":{"choiceNrMode":{"fdd":{}},"nrMode":1,"nrPci":1,"servedPlmns":["whatever"]},"nrNeighbourInfos":[{"nrCgi":"whatever","choiceNrMode":{"fdd":{}},"nrMode":1,"nrPci":1}]}]}
-${E2tInstanceAddress}   10.0.2.15:38000
 ${header}  {"Content-Type": "application/json"}
-${docker_command}  docker ps | grep Up | wc --lines
-${stop_simu}  docker stop gnbe2_oran_simu
-${run_simu_regular}  docker run -d --name gnbe2_oran_simu --net host --env gNBipv4=10.0.2.15 --env gNBport=5577 --env ricIpv4=10.0.2.15 --env ricPort=36422 --env nbue=0  snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/gnbe2_oran_simu:3.2-32
-${docker_Remove}    docker rm gnbe2_oran_simu
-${docker_restart}   docker restart e2mgr
-${restart_simu}  docker restart gnbe2_oran_simu
-${start_e2}  docker start e2
-${stop_e2}      docker stop e2
-${dbass_start}   docker run -d --name dbass -p 6379:6379 --env DBAAS_SERVICE_HOST=10.0.2.15  snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/dbass:1.0.0
-${dbass_remove}    docker rm dbass
-${dbass_stop}      docker stop dbass
-${restart_simu}  docker restart gnbe2_oran_simu
-${stop_docker_e2}      docker stop e2
-${stop_routingmanager_sim}  docker stop rm_sim
-${start_routingmanager_sim}  docker start rm_sim
+
+#K8S
+${pods_number}    5
+${pods_number-1}    4
+${verify_all_pods_are_ready_command}  kubectl -n ricplt get pods | grep -E 'dbaas|e2mgr|rtmgr|gnbe2|e2term' | grep Running | grep 1/1 |wc --lines
+${stop_simu}  kubectl scale --replicas=0 deploy/oran-simulator-gnbe2-oran-simu -n=ricplt
+${start_simu}  kubectl scale --replicas=1 deploy/oran-simulator-gnbe2-oran-simu -n=ricplt
+${start_e2mgr}  kubectl scale --replicas=1 deploy/deployment-ricplt-e2mgr -n=ricplt
+${stop_e2mgr}      kubectl scale --replicas=0 deploy/deployment-ricplt-e2mgr -n=ricplt
+${start_e2}  kubectl scale --replicas=1 deploy/deployment-ricplt-e2term-alpha -n=ricplt
+${stop_e2}      kubectl scale --replicas=0 deploy/deployment-ricplt-e2term-alpha -n=ricplt
+${dbass_start}   kubectl -n ricplt scale statefulsets statefulset-ricplt-dbaas-server --replicas=1
+${dbass_stop}      kubectl -n ricplt scale statefulsets statefulset-ricplt-dbaas-server --replicas=0
+${stop_routing_manager}  kubectl scale --replicas=0 deploy/deployment-ricplt-rtmgr -n=ricplt
+${start_routing_manager}  kubectl scale --replicas=1 deploy/deployment-ricplt-rtmgr -n=ricplt
+${gnbe2_sim_pod}  kubectl -n ricplt get pods |grep gnbe2 | awk '{print $1}'
+${e2mgr_pod}  kubectl -n ricplt get pods |grep e2mgr | awk '{print $1}'
+${e2term_pod}  kubectl -n ricplt get pods |grep e2term | awk '{print $1}'
+${rtmgr_pod}  kubectl -n ricplt get pods |grep rtmgr | awk '{print $1}'
 
 
+#Logs
+${E2_INIT_message_type}    MType: 1100
+${Setup_failure_message_type}    MType: 12003
+${first_retry_to_retrieve_from_db}      RnibDataService.retry - retrying 1 GetNodeb
+${third_retry_to_retrieve_from_db}      RnibDataService.retry - after 3 attempts of GetNodeb
+${RIC_RES_STATUS_REQ_message_type_successfully_sent}     Message type: 10090 - Successfully sent RMR message
+${E2_TERM_KEEP_ALIVE_REQ_message_type_successfully_sent}     Message type: 1101 - Successfully sent RMR message
+${save_general_configuration}      SetGeneralConfigurationHandler.Handle - save general configuration to rnib: {EnableRic:false}
+${set_and_publish_disconnect}      RnibDataService.UpdateNodebInfoOnConnectionStatusInversion - stateChangeMessageChannel: RAN_CONNECTION_STATUS_CHANGE, event: gnb_208_092_303030_DISCONNECTED
 
index 979da9a..8e59c42 100644 (file)
 import config
 import redis
 import time
+import k8s_helper
 
 
-def flush():
-
+def flush(set_new_timestamp):
     c = config.redis_ip_address
 
     p = config.redis_ip_port
 
-    r = redis.Redis(host=c, port=p, db=0)
-
-    r.flushall()
-    r.set("{e2Manager},GENERAL","{\"enableRic\":true}")
-    r.set("{e2Manager},E2TAddresses", "[\"10.0.2.15:38000\"]")
-    r.set("{e2Manager},E2TInstance:10.0.2.15:38000","{\"address\":\"10.0.2.15:38000\",\"associatedRanList\":[],\"keepAliveTimestamp\":" + str(int((time.time()+2) * 1000000000)) + ",\"state\":\"ACTIVE\",\"deletionTimeStamp\":0}")
-
-    return True
+    r = redis.Redis(host=c, port=p, db=0, )
 
+    e2t_ip = k8s_helper.extract_service_ip("e2term-rmr-alpha")
+    et2_address = e2t_ip + ":38000"
 
+    r.flushall()
+    r.set("{e2Manager},GENERAL", "{\"enableRic\":true}")
+    r.set("{e2Manager},E2TAddresses", "[\"{}\"]".format(et2_address))
 
+    timestamp = str(int((time.time() + 2) * 1000000000)) if set_new_timestamp else str(
+        int((time.time() - 300) * 1000000000))
+    r.set("{{e2Manager}},E2TInstance:{}".format(et2_address),
+          "{{\"address\":\"{}\",\"associatedRanList\":[],\"keepAliveTimestamp\":".format(et2_address) + timestamp +
+          ",\"state\":\"ACTIVE\",\"deletionTimeStamp\":0}")
 
+    return True
index f33cd51..e4379eb 100644 (file)
@@ -20,5 +20,5 @@
 #   platform project (RICP).
 #
 
-redis_ip_address = 'localhost'
-redis_ip_port = 6379
+redis_ip_address = '10.0.2.15'
+redis_ip_port = 30000
index b209ea3..abc46e2 100644 (file)
 import config
 import json
 import redis
+import variables
 
 
-def getRedisClientDecodeResponse():
+def get_redis_client_decode_response():
     c = config.redis_ip_address
     p = config.redis_ip_port
     return redis.Redis(host=c, port=p, db=0, decode_responses=True)
 
 
-def verify_ran_is_associated_with_e2t_instance(ranName, e2tAddress):
-    r = getRedisClientDecodeResponse()
-    e2tInstanceJson = r.get("{e2Manager},E2TInstance:" + e2tAddress)
-    e2tInstanceDic = json.loads(e2tInstanceJson)
-    assocRanList = e2tInstanceDic.get("associatedRanList")
-    return ranName in assocRanList
+def verify_ran_is_associated_with_e2t_instance(ran_name, e2t_address):
+    r = get_redis_client_decode_response()
+    e2t_instance_json = r.get("{e2Manager},E2TInstance:" + e2t_address)
 
+    if e2t_instance_json is None:
+        return False
 
-def verify_e2t_instance_has_no_associated_rans(e2tAddress):
-    r = getRedisClientDecodeResponse()
-    e2tInstanceJson = r.get("{e2Manager},E2TInstance:" + e2tAddress)
-    e2tInstanceDic = json.loads(e2tInstanceJson)
-    assocRanList = e2tInstanceDic.get("associatedRanList")
-    return not assocRanList
+    e2t_instance_dic = json.loads(e2t_instance_json)
+    assoc_ran_list = e2t_instance_dic.get("associatedRanList")
+    if assoc_ran_list is None:
+        return False
+    else:
+        return ran_name in assoc_ran_list
 
 
-def verify_e2t_instance_exists_in_addresses(e2tAddress):
-    r = getRedisClientDecodeResponse()
-    e2tAddressesJson = r.get("{e2Manager},E2TAddresses")
-    e2tAddresses = json.loads(e2tAddressesJson)
-    return e2tAddress in e2tAddresses
+def verify_e2t_instance_has_no_associated_rans(e2t_address):
+    r = get_redis_client_decode_response()
+    e2t_instance_json = r.get("{e2Manager},E2TInstance:" + e2t_address)
+    e2t_instance_dic = json.loads(e2t_instance_json)
+    assoc_ran_list = e2t_instance_dic.get("associatedRanList")
+    return not assoc_ran_list
 
 
-def verify_e2t_instance_key_exists(e2tAddress):
-    r = getRedisClientDecodeResponse()
-    return r.exists("{e2Manager},E2TInstance:" + e2tAddress)
+def verify_e2t_instance_exists_in_addresses(e2t_address):
+    r = get_redis_client_decode_response()
+    e2t_addresses_json = r.get("{e2Manager},E2TAddresses")
+    e2t_addresses = json.loads(e2t_addresses_json)
+    return e2t_address in e2t_addresses
+
+
+def verify_e2t_instance_key_exists(e2t_address):
+    r = get_redis_client_decode_response()
+    return r.exists("{e2Manager},E2TInstance:" + e2t_address)
 
 
 def populate_e2t_instances_in_e2m_db_for_get_e2t_instances_tc():
-    r = getRedisClientDecodeResponse()
+    r = get_redis_client_decode_response()
     r.set("{e2Manager},E2TAddresses", "[\"e2t.att.com:38000\"]")
     r.set("{e2Manager},E2TInstance:e2t.att.com:38000",
-          "{\"address\":\"e2t.att.com:38000\",\"associatedRanList\":[\"test1\",\"test2\",\"test3\"],\"keepAliveTimestamp\":1577619310484022369,\"state\":\"ACTIVE\"}")
+          "{\"address\":\"e2t.att.com:38000\",\"associatedRanList\":[\"test1\",\"test2\",\"test3\"],"
+          "\"keepAliveTimestamp\":1577619310484022369,\"state\":\"ACTIVE\"}")
+    return True
+
+
+def verify_e2t_addresses_for_e2t_initialization_tc():
+    r = get_redis_client_decode_response()
+
+    value = "[\"{}\"]".format(variables.e2t_alpha_address)
+
+    return r.get("{e2Manager},E2TAddresses") == value
+
+
+def verify_e2t_instance_for_e2t_initialization_tc():
+    r = get_redis_client_decode_response()
+
+    e2_address = "\"address\":\"{}\"".format(variables.e2t_alpha_address)
+    e2_associated_ran_list = "\"associatedRanList\":[]"
+    e2_state = "\"state\":\"ACTIVE\""
+
+    e2_db_instance = r.get("{{e2Manager}},E2TInstance:{}".format(variables.e2t_alpha_address))
+
+    if e2_db_instance.find(e2_address) < 0:
+        return False
+    if e2_db_instance.find(e2_associated_ran_list) < 0:
+        return False
+    if e2_db_instance.find(e2_state) < 0:
+        return False
+
     return True
 
 
 def set_enable_ric_false():
-    r = getRedisClientDecodeResponse()
+    r = get_redis_client_decode_response()
     r.set("{e2Manager},GENERAL", "{\"enableRic\":false}")
     return True
+
diff --git a/Automation/Tests/Scripts/e2t_db_script.py b/Automation/Tests/Scripts/e2t_db_script.py
deleted file mode 100644 (file)
index 045353c..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-##############################################################################
-#
-#   Copyright (c) 2019 AT&T Intellectual Property.
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-#
-##############################################################################
-
-import config
-import redis
-
-
-def getRedisClientDecodeResponse():
-
-    c = config.redis_ip_address
-
-    p = config.redis_ip_port
-
-    return redis.Redis(host=c, port=p, db=0, decode_responses=True)
-
-
-def verify_e2t_addresses_key():
-
-    r = getRedisClientDecodeResponse()
-    
-    value = "[\"10.0.2.15:38000\"]"
-
-    return r.get("{e2Manager},E2TAddresses") == value
-
-
-def verify_e2t_instance_key():
-
-    r = getRedisClientDecodeResponse()
-
-    e2_address = "\"address\":\"10.0.2.15:38000\""
-    e2_associated_ran_list = "\"associatedRanList\":[]"
-    e2_state = "\"state\":\"ACTIVE\""
-
-    e2_db_instance = r.get("{e2Manager},E2TInstance:10.0.2.15:38000")
-
-    if e2_db_instance.find(e2_address) < 0:
-        return False
-    if e2_db_instance.find(e2_associated_ran_list) < 0:
-        return False
-    if e2_db_instance.find(e2_state) < 0:
-        return False
-
-    return True
\ No newline at end of file
index 2161094..aa289ed 100644 (file)
@@ -33,7 +33,7 @@ def add():
 
     r = redis.Redis(host=c, port=p, db=0)
 
-    cleanup_db.flush()
+    cleanup_db.flush(True)
 
     r.set("{e2Manager},ENB:02f829:007a80", "\n\x05test1\x12\t10.0.2.15\x18\xc9+ \x01*\x10\n\x0602f829\x12\x06007a800\x01:3\b\x01\x12/\bc\x12\x0f02f829:0007ab50\x1a\x040102\"\x0602f829*\n\n\b\b\x01\x10\x01\x18\x04 \x040\x01")
 
diff --git a/Automation/Tests/Scripts/k8s_helper.py b/Automation/Tests/Scripts/k8s_helper.py
new file mode 100644 (file)
index 0000000..80b1829
--- /dev/null
@@ -0,0 +1,32 @@
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+#
+#   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+#   platform project (RICP).
+#
+
+import subprocess
+
+
+def extract_service_ip(service_name):
+    k8s_command = "kubectl -n ricplt get services | /bin/grep {} | /bin/grep ClusterIP |  awk \'{{print $3}}\'"\
+        .format(service_name)
+
+    service_ip = subprocess.check_output(["/bin/bash", "-c", k8s_command], universal_newlines=True)
+
+    return service_ip.strip()
diff --git a/Automation/Tests/Scripts/variables.py b/Automation/Tests/Scripts/variables.py
new file mode 100644 (file)
index 0000000..14c3747
--- /dev/null
@@ -0,0 +1,28 @@
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+#
+#   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+#   platform project (RICP).
+#
+import k8s_helper
+
+e2mgr_ip = k8s_helper.extract_service_ip("e2mgr-http")
+e2mgr_address = "http://" + e2mgr_ip + ":3800"
+
+e2t_alpha_ip = k8s_helper.extract_service_ip("e2term-rmr-alpha")
+e2t_alpha_address = e2t_alpha_ip + ":38000"
index c6f74c1..129f3a9 100644 (file)
@@ -22,8 +22,8 @@
 
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
-Resource   ../Resource/scripts_variables.robot
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
 Library    ../Scripts/find_error_script.py
@@ -31,6 +31,9 @@ Library     OperatingSystem
 Library     REST        ${url}
 
 
+*** Variables ***
+${url}  ${e2mgr_address}
+
 
 
 *** Test Cases ***
index 052579b..75e045d 100644 (file)
 
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
-Resource    ../Resource/scripts_variables.robot
 Library     OperatingSystem
 Library     ../Scripts/find_rmr_message.py
 Library     REST        ${url}
-Suite Teardown  Start RoutingManager Simulator
-
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 
 *** Test Cases ***
 Stop Routing manager simulator and restarting simulator
-    Stop RoutingManager Simulator
-    Restart simulator with less docker
+    Stop Routing Manager
+    restart simulator
+    wait until keyword succeeds  1 min    10 sec    Validate Required Dockers    ${pods_number-1}
 
 prepare logs for tests
     Remove log files
@@ -61,6 +62,10 @@ E2M Logs - Verify RMR Message
     ${result}    find_rmr_message.verify_logs   ${EXECDIR}   ${e2mgr_log_filename}  ${Setup_failure_message_type}    ${None}
     Should Be Equal As Strings    ${result}      True
 
+[Teardown]    Run Keywords
+              Start Routing Manager
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
+
 
 
 
index 99df9a3..b71959e 100644 (file)
 #
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
 Library     REST      ${url}
-Suite Teardown   Start Dbass
+
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 Get All nodes - 500 http - 500 RNIB error
@@ -35,4 +38,6 @@ Get All nodes - 500 http - 500 RNIB error
     Integer  response body errorCode            500
     String   response body errorMessage     RNIB error
 
-
+[Teardown]    Run Keywords
+              Start Dbass
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
index 54f2c3f..c7ca3a1 100644 (file)
 #
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
 Library     OperatingSystem
 Library     REST      ${url}
 
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 Get Request node b gnb - resource not found 404
@@ -35,3 +38,5 @@ Get Request node b gnb - resource not found 404
     Integer   response body errorCode   404
     String   response body errorMessage   "Resource not found"
 
+
+
index 05badb6..c74f1c6 100644 (file)
 #
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
-Resource    ../Resource/scripts_variables.robot
 Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
 Library    ../Scripts/find_error_script.py
 Library     OperatingSystem
 Library     REST      ${url}
-Suite Teardown   Start Dbass
+
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 Get node b gnb - DB down - 500
@@ -51,3 +53,6 @@ Verify e2mgr logs - Third retry to retrieve from db
    ${result}    find_error_script.find_error     ${EXECDIR}  ${e2mgr_log_filename}   ${third_retry_to_retrieve_from_db}
    Should Be Equal As Strings    ${result}      True
 
+[Teardown]    Run Keywords
+              Start Dbass
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
\ No newline at end of file
index 048155c..2d1fff8 100644 (file)
 #
 
 *** Settings ***
+Variables  ../Scripts/variables.py
 Suite Setup   Prepare Enviorment
 Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
 Library     REST      ${url}
-Suite Teardown   Start Dbass
+
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 Red Button - Shut Dwon - 500 RNIB error
@@ -36,3 +39,6 @@ Red Button - Shut Dwon - 500 RNIB error
     String   response body errorMessage     RNIB error
 
 
+[Teardown]    Run Keywords
+              Start Dbass
+              AND wait until keyword succeeds  1 min    10 sec    Validate Required Dockers
\ No newline at end of file
 
 
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment  ${True}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
 Library     OperatingSystem
 Library     REST        ${url}
 
 
-
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 
 
 
 *** Settings ***
-Suite Setup   Prepare Enviorment
+Variables  ../Scripts/variables.py
+Suite Setup   Prepare Enviorment  ${True}
 Resource   ../Resource/resource.robot
 Resource   ../Resource/Keywords.robot
 Library     OperatingSystem
 Library     REST        ${url}
 
 
-
+*** Variables ***
+${url}  ${e2mgr_address}
 
 *** Test Cases ***
 
-Update Ran
+Update gNB
     Sleep  2s
     Update Ran request
     Integer  response status  200
index f0c36f7..d29767f 100644 (file)
@@ -36,8 +36,8 @@ Library     REST      ${url}
 
 Pre Condition for Connecting - no simu
     Run And Return Rc And Output    ${stop_simu}
-    ${result}=  Run And Return Rc And Output     ${docker_command}
-    Should Be Equal As Integers    ${result[1]}    ${docker_number-1}
+    ${result}=  Run And Return Rc And Output     ${verify_all_pods_are_ready_command}
+    Should Be Equal As Integers    ${result[1]}    ${pods_number-1}
 
 Reset - 400 http - 403 wrong state
     Post Request setup node b x-2
index 0e7e9c4..4d45493 100644 (file)
@@ -26,11 +26,11 @@ Resource   ../Resource/Keywords.robot
 Resource   ../Resource/resource.robot
 Library     ../Scripts/e2mdbscripts.py
 Library     REST      ${url}
-Suite Teardown   Start RoutingManager Simulator
+Suite Teardown   Start Routing Manager And Validate Pods
 
 *** Test Cases ***
 ENDC-setup - 503 http - 511 No Routing Manager Available
-    Stop RoutingManager Simulator
+    Stop Routing Manager
     Set Headers     ${header}
     POST     /v1/nodeb/x2-setup    ${json}
     Integer  response status            503
index 8dc416b..fce40e7 100644 (file)
@@ -76,6 +76,6 @@ Start Dbass with 4 dockers
      Run And Return Rc And Output    ${dbass_remove}
      Run And Return Rc And Output    ${dbass_start}
      Sleep  5s
-     ${result}=  Run And Return Rc And Output     ${docker_command}
-     Should Be Equal As Integers    ${result[1]}    ${docker_number-1}
+     ${result}=  Run And Return Rc And Output     ${verify_all_pods_are_ready_command}
+     Should Be Equal As Integers    ${result[1]}    ${pods_number-1}
 
index a0c9ca9..be69709 100644 (file)
@@ -1,5 +1,5 @@
 #----- Default SonarQube server
-sonar.host.url=http://135.25.121.110:9000
+sonar.host.url=http://135.76.210.196:9000
 sonar.projectKey=oran:e2mgr
 sonar.projectName=e2mgr
 sonar.login=admin
@@ -7,7 +7,7 @@ sonar.password=admin
 sonar.go.coverage.reportPaths=coverage.txt
 #----- Default source code encoding
 #sonar.sourceEncoding=UTF-8
-sonar.projectBaseDir=/home/ubuntu/oran_repo/e2mgr/E2Manager/
+sonar.projectBaseDir=/home/vagrant/oran_repo/e2mgr/E2Manager/
 sonar.sources=.
 sonar.exclusions=**/*_test.go,**/generate_source.go,**/*_generated.go,**/build/**,**/.gogradle/**,**/mocks/**,**/tests/**,**/e2managererrors/**,**/enums/**
 sonar.go.golangci-lint.reportPaths=sca.xml