From 09288ab8d9de67eb9ac73bf8ac1e6eb79dcb2cb4 Mon Sep 17 00:00:00 2001 From: ec472j Date: Thu, 23 Apr 2020 13:13:01 +0300 Subject: [PATCH] Automation for setup failure and update gnb Change-Id: I7a2e346b3327f2b44069ade01d685773812d4425 Signed-off-by: ec472j --- Automation/Tests/Resource/Keywords.robot | 12 ++++- Automation/Tests/Resource/resource.robot | 5 +- Automation/Tests/Scripts/cleanup_db.py | 4 +- Automation/Tests/Scripts/e2t_db_script.py | 6 +-- Automation/Tests/Setup_Failure/Setup_failure.robot | 60 ++++++++++++++++++++++ Automation/Tests/Setup_Failure/__init__.robot | 24 +++++++++ .../Tests/Update_Ran/Update_ran_Unhappy.robot | 50 ++++++++++++++++++ Automation/Tests/Update_Ran/Update_ran_happy.robot | 59 +++++++++++++++++++++ Automation/Tests/Update_Ran/__init__.robot | 24 +++++++++ 9 files changed, 237 insertions(+), 7 deletions(-) create mode 100644 Automation/Tests/Setup_Failure/Setup_failure.robot create mode 100644 Automation/Tests/Setup_Failure/__init__.robot create mode 100644 Automation/Tests/Update_Ran/Update_ran_Unhappy.robot create mode 100644 Automation/Tests/Update_Ran/Update_ran_happy.robot create mode 100644 Automation/Tests/Update_Ran/__init__.robot diff --git a/Automation/Tests/Resource/Keywords.robot b/Automation/Tests/Resource/Keywords.robot index ce07adc..46296d8 100644 --- a/Automation/Tests/Resource/Keywords.robot +++ b/Automation/Tests/Resource/Keywords.robot @@ -31,8 +31,15 @@ Get Request node b gnb Sleep 1s GET ${getNodeb} +Update Ran request + Sleep 1s + PUT ${update_gnb_url} ${update_gnb_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} @@ -114,5 +121,8 @@ Start RoutingManager Simulator 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} diff --git a/Automation/Tests/Resource/resource.robot b/Automation/Tests/Resource/resource.robot index 1239b06..29e15f8 100644 --- a/Automation/Tests/Resource/resource.robot +++ b/Automation/Tests/Resource/resource.robot @@ -30,7 +30,10 @@ ${docker_number-1} 4 ${url} http://localhost:3800 ${ranName} gnb:208-092-303030 ${getNodeb} /v1/nodeb/${ranName} -${E2tInstanceAddress} 127.0.0.1:38000 +${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 diff --git a/Automation/Tests/Scripts/cleanup_db.py b/Automation/Tests/Scripts/cleanup_db.py index 0bae97e..4dd3ff0 100644 --- a/Automation/Tests/Scripts/cleanup_db.py +++ b/Automation/Tests/Scripts/cleanup_db.py @@ -34,9 +34,9 @@ def flush(): r.flushall() - r.set("{e2Manager},E2TAddresses", "[\"127.0.0.1:38000\"]") + r.set("{e2Manager},E2TAddresses", "[\"10.0.2.15:38000\"]") - r.set("{e2Manager},E2TInstance:127.0.0.1:38000","{\"address\":\"127.0.0.1:38000\",\"associatedRanList\":[],\"keepAliveTimestamp\":" + str(int((time.time()+2) * 1000000000)) + ",\"state\":\"ACTIVE\",\"deletionTimeStamp\":0}") + 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 diff --git a/Automation/Tests/Scripts/e2t_db_script.py b/Automation/Tests/Scripts/e2t_db_script.py index bd54b08..045353c 100644 --- a/Automation/Tests/Scripts/e2t_db_script.py +++ b/Automation/Tests/Scripts/e2t_db_script.py @@ -33,7 +33,7 @@ def verify_e2t_addresses_key(): r = getRedisClientDecodeResponse() - value = "[\"127.0.0.1:38000\"]" + value = "[\"10.0.2.15:38000\"]" return r.get("{e2Manager},E2TAddresses") == value @@ -42,11 +42,11 @@ def verify_e2t_instance_key(): r = getRedisClientDecodeResponse() - e2_address = "\"address\":\"127.0.0.1:38000\"" + e2_address = "\"address\":\"10.0.2.15:38000\"" e2_associated_ran_list = "\"associatedRanList\":[]" e2_state = "\"state\":\"ACTIVE\"" - e2_db_instance = r.get("{e2Manager},E2TInstance:127.0.0.1:38000") + e2_db_instance = r.get("{e2Manager},E2TInstance:10.0.2.15:38000") if e2_db_instance.find(e2_address) < 0: return False diff --git a/Automation/Tests/Setup_Failure/Setup_failure.robot b/Automation/Tests/Setup_Failure/Setup_failure.robot new file mode 100644 index 0000000..ebc0bc5 --- /dev/null +++ b/Automation/Tests/Setup_Failure/Setup_failure.robot @@ -0,0 +1,60 @@ +############################################################################## +# +# 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 *** +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/rsmscripts.py +Library REST ${url} +Suite Teardown Start RoutingManager Simulator + + + + +*** Test Cases *** +Stop Routing manager simulator and restarting simulator + Stop RoutingManager Simulator + Restart simulator with less docker + +Get request gnb + Sleep 2s + Get Request node b gnb + Integer response status 200 + String response body ranName ${ranname} + String response body connectionStatus DISCONNECTED + String response body nodeType GNB + Integer response body gnb ranFunctions 0 ranFunctionId 1 + Integer response body gnb ranFunctions 0 ranFunctionRevision 1 + Integer response body gnb ranFunctions 1 ranFunctionId 2 + Integer response body gnb ranFunctions 1 ranFunctionRevision 1 + Integer response body gnb ranFunctions 2 ranFunctionId 3 + Integer response body gnb ranFunctions 2 ranFunctionRevision 1 + + + + + diff --git a/Automation/Tests/Setup_Failure/__init__.robot b/Automation/Tests/Setup_Failure/__init__.robot new file mode 100644 index 0000000..51e9ef6 --- /dev/null +++ b/Automation/Tests/Setup_Failure/__init__.robot @@ -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 Setup Failure diff --git a/Automation/Tests/Update_Ran/Update_ran_Unhappy.robot b/Automation/Tests/Update_Ran/Update_ran_Unhappy.robot new file mode 100644 index 0000000..25fd953 --- /dev/null +++ b/Automation/Tests/Update_Ran/Update_ran_Unhappy.robot @@ -0,0 +1,50 @@ +############################################################################## +# +# 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 *** +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/rsmscripts.py +Library REST ${url} + + + + +*** Test Cases *** + +Update Ran Unhappy + Sleep 2s + Update Ran request not valid + Integer response status 400 + Integer response body errorCode 402 + String response body errorMessage Validation error + + + + + + diff --git a/Automation/Tests/Update_Ran/Update_ran_happy.robot b/Automation/Tests/Update_Ran/Update_ran_happy.robot new file mode 100644 index 0000000..f583d21 --- /dev/null +++ b/Automation/Tests/Update_Ran/Update_ran_happy.robot @@ -0,0 +1,59 @@ +############################################################################## +# +# 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 *** +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/rsmscripts.py +Library REST ${url} + + + + +*** Test Cases *** + +Update Ran + Sleep 2s + Update Ran request + Integer response status 200 + String response body ranName ${ranname} + String response body connectionStatus CONNECTED + String response body nodeType GNB + String response body gnb servedNrCells 0 servedNrCellInformation cellId abcd + String response body gnb servedNrCells 0 nrNeighbourInfos 0 nrCgi one + String response body gnb servedNrCells 0 servedNrCellInformation servedPlmns 0 whatever + + + + + + + + + + + diff --git a/Automation/Tests/Update_Ran/__init__.robot b/Automation/Tests/Update_Ran/__init__.robot new file mode 100644 index 0000000..5cca474 --- /dev/null +++ b/Automation/Tests/Update_Ran/__init__.robot @@ -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 Update Ran -- 2.16.6