blob: e506657a4f4195cfc35fc1afd763045ab5cc203d [file] [log] [blame]
Amichai4db397d2019-08-28 19:23:15 +03001##############################################################################
2#
3# Copyright (c) 2019 AT&T Intellectual Property.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17##############################################################################
nm755n15d39822019-11-28 16:56:00 +000018#
19# This source code is part of the near-RT RIC (RAN Intelligent Controller)
20# platform project (RICP).
21#
Amichai4db397d2019-08-28 19:23:15 +030022
23*** Settings ***
24Documentation Keywords file
ss412gde190682019-10-24 09:29:26 +030025Library ../Scripts/cleanup_db.py
ss412g35766cc2020-07-21 13:46:58 +000026Library ../Scripts/k8s_helper.py
Amichai4db397d2019-08-28 19:23:15 +030027Resource ../Resource/resource.robot
28Library OperatingSystem
ss412g35766cc2020-07-21 13:46:58 +000029Library Process
Amichai4db397d2019-08-28 19:23:15 +030030
Amichai4db397d2019-08-28 19:23:15 +030031*** Keywords ***
ec472j09950082020-04-08 16:44:48 +030032Get Request node b gnb
Amichai4db397d2019-08-28 19:23:15 +030033 Sleep 1s
ec472j09950082020-04-08 16:44:48 +030034 GET ${getNodeb}
Amichai4db397d2019-08-28 19:23:15 +030035
idanshal70008802020-07-23 06:16:41 +000036Update Gnb request
ec472j09288ab2020-04-23 13:13:01 +030037 Sleep 1s
38 PUT ${update_gnb_url} ${update_gnb_body}
ec472j09950082020-04-08 16:44:48 +030039
ss412g5aa1fb82020-07-16 10:30:28 +000040Add eNb Request
41 Sleep 1s
ss412g35766cc2020-07-21 13:46:58 +000042 POST ${enb_url} ${add_enb_request_body}
43
44Delete eNb Request
45 Sleep 1s
46 DELETE ${enb_url}/${enb_ran_name}
47
48Update eNb Request
49 Sleep 1s
50 PUT ${enb_url}/${enb_ran_name} ${update_enb_request_body}
ss412g5aa1fb82020-07-16 10:30:28 +000051
ss412ga07b8592020-06-16 21:51:33 +030052Set General Configuration request
53 Sleep 1s
54 PUT ${set_general_configuration} ${set_general_configuration_body}
Amichai4db397d2019-08-28 19:23:15 +030055
idanshal70008802020-07-23 06:16:41 +000056Update Gnb request not valid
ec472j09288ab2020-04-23 13:13:01 +030057 Sleep 1s
58 PUT ${update_gnb_url} ${update_gnb_body_notvalid}
59
ss412gde190682019-10-24 09:29:26 +030060Remove log files
61 Remove File ${EXECDIR}/${gnb_log_filename}
62 Remove File ${EXECDIR}/${e2mgr_log_filename}
ss412gefcb4522019-12-02 16:59:19 +020063 Remove File ${EXECDIR}/${e2t_log_filename}
ss412gde190682019-10-24 09:29:26 +030064
ss412g35766cc2020-07-21 13:46:58 +000065
ss412gde190682019-10-24 09:29:26 +030066Save logs
67 Sleep 1s
68 Run ${Save_sim_log}
69 Run ${Save_e2mgr_log}
ss412gefcb4522019-12-02 16:59:19 +020070 Run ${Save_e2t_log}
ss412g42996b72019-09-10 14:30:26 +030071
ss412ge7dbffd2019-09-03 18:34:28 +030072Prepare Enviorment
ss412gef8e7b22020-07-14 21:54:24 +000073 [Arguments] ${need_to_restart_pods}=${False} ${set_new_timestamp}=${True}
74 Init logs
75 Flush And Populate DB ${set_new_timestamp}
76 Run keyword if ${need_to_restart_pods}==${True} Restart RM and GNB Simulator
ss412g45758a82020-07-27 08:09:49 +000077 Wait until keyword succeeds 2 min 10 sec Validate Required Dockers
Amichaif846c592020-01-08 16:45:07 +020078
ss412gef8e7b22020-07-14 21:54:24 +000079Restart RM and GNB Simulator
80 Restart routing manager
ss412g45758a82020-07-27 08:09:49 +000081 Wait until keyword succeeds 2 min 10 sec Validate Required Dockers
ss412gef8e7b22020-07-14 21:54:24 +000082 Restart simulator
83
84
85Init logs
86 ${starting_timestamp} Evaluate datetime.datetime.now(datetime.timezone.utc).isoformat("T") modules=datetime
87 ${e2t_log_filename} Evaluate "e2t.${SUITE NAME}.log".replace(" ","-")
88 ${e2mgr_log_filename} Evaluate "e2mgr.${SUITE NAME}.log".replace(" ","-")
89 ${gnb_log_filename} Evaluate "gnb.${SUITE NAME}.log".replace(" ","-")
90 ${Save_sim_log} Evaluate "kubectl -n ricplt logs --since-time=${starting_timestamp} $(${gnbe2_sim_pod}) > ${gnb_log_filename}"
91 ${Save_e2mgr_log} Evaluate "kubectl -n ricplt logs --since-time=${starting_timestamp} $(${e2mgr_pod}) > ${e2mgr_log_filename}"
92 ${Save_e2t_log} Evaluate "kubectl -n ricplt logs --since-time=${starting_timestamp} $(${e2term_pod}) > ${e2t_log_filename}"
ss412gef8e7b22020-07-14 21:54:24 +000093 Set Suite Variable ${e2t_log_filename}
94 Set Suite Variable ${e2mgr_log_filename}
95 Set Suite Variable ${gnb_log_filename}
96 Set Suite Variable ${Save_sim_log}
97 Set Suite Variable ${Save_e2mgr_log}
98 Set Suite Variable ${Save_e2t_log}
99
100Validate Required Dockers
101 [Arguments] ${required_number_of_dockers}=${pods_number}
102 Log To Console Validating all required dockers are up
103 ${result}= Run And Return Rc And Output ${verify_all_pods_are_ready_command}
104 Should Be Equal As Integers ${result[1]} ${required_number_of_dockers}
ss412ge7dbffd2019-09-03 18:34:28 +0300105
106Start E2
ss412gef8e7b22020-07-14 21:54:24 +0000107 Log to Console Starting E2Term
ss412ge7dbffd2019-09-03 18:34:28 +0300108 Run And Return Rc And Output ${start_e2}
ss412gef8e7b22020-07-14 21:54:24 +0000109 Sleep 5s
ss412ge7dbffd2019-09-03 18:34:28 +0300110
ss412gefcb4522019-12-02 16:59:19 +0200111Stop E2
ss412gef8e7b22020-07-14 21:54:24 +0000112 Log to Console Stopping E2Term
ss412gefcb4522019-12-02 16:59:19 +0200113 Run And Return Rc And Output ${stop_e2}
ss412gef8e7b22020-07-14 21:54:24 +0000114 Sleep 5s
115
116Start E2 Manager
117 Log to Console Starting E2Mgr
118 Run And Return Rc And Output ${start_e2mgr}
119 Sleep 5s
120
121Stop E2 Manager
122 Log to Console Stopping E2Mgr
123 Run And Return Rc And Output ${stop_e2mgr}
124 Sleep 5s
ss412gefcb4522019-12-02 16:59:19 +0200125
ss412gde190682019-10-24 09:29:26 +0300126Start Dbass
ss412gef8e7b22020-07-14 21:54:24 +0000127 Log to Console Starting redis
ss412gde190682019-10-24 09:29:26 +0300128 Run And Return Rc And Output ${dbass_start}
ss412gef8e7b22020-07-14 21:54:24 +0000129 Sleep 5s
ss412gde190682019-10-24 09:29:26 +0300130
131Stop Dbass
ss412gef8e7b22020-07-14 21:54:24 +0000132 Log to Console Stopping redis
ss412gde190682019-10-24 09:29:26 +0300133 Run And Return Rc And Output ${dbass_stop}
ss412gef8e7b22020-07-14 21:54:24 +0000134 Sleep 5s
135
136Stop Simulator
137 log to console Stopping gnbe2 simulator
138 Run And Return Rc And Output ${stop_simu}
ss412g45758a82020-07-27 08:09:49 +0000139 Sleep 70s
ss412gef8e7b22020-07-14 21:54:24 +0000140
141Start Simulator
142 log to console Starting gnbe2 simulator
143 Run And Return Rc And Output ${start_simu}
ss412ge7dbffd2019-09-03 18:34:28 +0300144
ss412gefcb4522019-12-02 16:59:19 +0200145Restart simulator
ss412gef8e7b22020-07-14 21:54:24 +0000146 Log to Console Restarting gnbe2 simulator
147 Stop Simulator
148 Start Simulator
ss412gefcb4522019-12-02 16:59:19 +0200149
ss412gef8e7b22020-07-14 21:54:24 +0000150Start Routing Manager
151 Log to Console Starting routing manager
152 Run And Return Rc And Output ${start_routing_manager}
153 Sleep 5s
ss412ge7dbffd2019-09-03 18:34:28 +0300154
ss412gef8e7b22020-07-14 21:54:24 +0000155Stop Routing Manager
156 Log to Console Stopping routing manager
157 Run And Return Rc And Output ${stop_routing_manager}
158 Sleep 5s
ss412ge7dbffd2019-09-03 18:34:28 +0300159
ss412gef8e7b22020-07-14 21:54:24 +0000160Restart Routing Manager
161 Log to Console Restarting routing manager
162 Stop Routing Manager
163 Start Routing Manager
Amichai4db397d2019-08-28 19:23:15 +0300164
ss412ga07b8592020-06-16 21:51:33 +0300165Flush And Populate DB
ss412gef8e7b22020-07-14 21:54:24 +0000166 [Arguments] ${set_new_timestamp}=${True}
167 Log To Console Flushing and populating DB
168 ${flush}= cleanup_db.flush ${set_new_timestamp}
ss412ga07b8592020-06-16 21:51:33 +0300169 Sleep 2s
ss412gef8e7b22020-07-14 21:54:24 +0000170 Should Be Equal As Strings ${flush} True
171
172Stop All Pods Except Simulator
173 Stop E2 Manager
174 Stop Dbass
175 Stop E2
176 Stop Routing Manager
ss412ga07b8592020-06-16 21:51:33 +0300177
ss412g35766cc2020-07-21 13:46:58 +0000178Start Redis Monitor
179 Log To Console Starting redis monitor log
180 ${redis_monitor_log_filename} Evaluate "redis_monitor.${SUITE NAME}.log".replace(" ","-")
181 Set Suite Variable ${redis_monitor_log_filename}
182 Remove File ${EXECDIR}/${redis_monitor_log_filename}
183 Start Process kubectl -n ricplt exec -it statefulset-ricplt-dbaas-server-0 redis-cli MONITOR>${EXECDIR}/${redis_monitor_log_filename} shell=yes
184
185Stop Redis Monitor
186 Log To Console Stopping redis monitor log
187 log_scripts.kill_redis_monitor_root_process
188
189
190Redis Monitor Logs - Verify Publish To Manipulation Channel
ss412g45758a82020-07-27 08:09:49 +0000191 [Arguments] ${ran_name} ${event}
ss412g35766cc2020-07-21 13:46:58 +0000192 Log To Console Verify Publish To Manipulation Channel
ss412g45758a82020-07-27 08:09:49 +0000193 ${result}= log_scripts.verify_redis_monitor_manipulation_message ${EXECDIR}/${redis_monitor_log_filename} ${ran_name} ${event}
ss412g35766cc2020-07-21 13:46:58 +0000194 Should Be Equal As Strings ${result} True
195
196Redis Monitor Logs - Verify Publish To Connection Status Channel
ss412g45758a82020-07-27 08:09:49 +0000197 [Arguments] ${ran_name} ${event}
ss412g35766cc2020-07-21 13:46:58 +0000198 Log To Console Verify Publish To Connection Status Channel
ss412g45758a82020-07-27 08:09:49 +0000199 ${result}= log_scripts.verify_redis_monitor_connection_status_message ${EXECDIR}/${redis_monitor_log_filename} ${ran_name} ${event}
ss412g35766cc2020-07-21 13:46:58 +0000200 Should Be Equal As Strings ${result} True