Library REST ${url}
-*** Variables ***
-${restart_docker_sim} docker restart gnbe2_simu
-
*** Test Cases ***
String response body connectionStatus SHUT_DOWN
Restart simualtor
-
- Run And Return Rc And Output ${restart_docker_sim}
- ${result}= Run And Return Rc And Output ${docker_command}
- Should Be Equal As Integers ${result[1]} ${docker_number}
-
+ Restart simulator
repare Ran in Connected connectionStatus
Post Request setup node b x-2
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}
${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_docker_sim}
+ ${result}= Run And Return Rc And Output ${docker_command}
+ Should Be Equal As Integers ${result[1]} ${docker_number}
+
${restart_simu} docker restart gnbe2_simu
${start_e2} docker start e2
${stop_docker_e2} docker stop e2
+${restart_docker_sim} docker restart gnbe2_simu
${Run_Config} docker exec gnbe2_simu pkill gnbe2_simu -INT
${403_reset_message} "Activity X2_RESET rejected. RAN current state DISCONNECTED does not allow its execution "
--- /dev/null
+##############################################################################
+#
+# 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
+import cleanup_db
+import json
+
+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_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 dissociate_ran_from_e2tInstance(ranName, e2tAddress):
+# r = getRedisClientDecodeResponse()
+# e2tInstanceJson = r.get("{e2Manager},E2TInstance:"+e2tAddress)
+# e2tInstanceDic = json.loads(e2tInstanceJson)
+# assocRanList = e2tInstanceDic.get("associatedRanList")
+# print(assocRanList)
+# assocRanList.remove(ranName)
+# updatedE2tInstanceJson = json.dumps(e2tInstanceDic)
+# print(updatedE2tInstanceJson)
+# r.set("{e2Manager},E2TInstance:"+e2tAddress, updatedE2tInstanceJson)
+# nodebBytes = r.get("{e2Manager},RAN:"+ranName)
+# encoded = nodebBytes.decode().replace(e2tAddress,"").encode()
+# r.set("{e2Manager},RAN:"+ranName, encoded)
+
Library OperatingSystem
Library ../Scripts/find_rmr_message.py
Library ../Scripts/rsmscripts.py
+Library ../Scripts/e2mdbscripts.py
Library REST ${url}
*** Test Cases ***
Integer response body port 5577
String response body connectionStatus CONNECTED
String response body nodeType ENB
+ String response body associatedE2tInstanceAddress e2t.att.com:38000
String response body enb enbType MACRO_ENB
Integer response body enb servedCells 0 pci 99
String response body enb servedCells 0 cellId 02f829:0007ab00
Verify RSM RAN info exists in redis
${result}= rsmscripts.verify_rsm_ran_info_start_false
- Should Be Equal As Strings ${result} True
\ No newline at end of file
+ Should Be Equal As Strings ${result} True
+
+Verify RAN is associated with E2T instance
+ ${result} e2mdbscripts.verify_ran_is_associated_with_e2t_instance test1 e2t.att.com:38000
+ Should Be True ${result}
+
+
+
--- /dev/null
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+
+*** 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 ../Scripts/e2mdbscripts.py
+Library REST ${url}
+
+*** Test Cases ***
+X2 - Setup Test 1
+ Post Request setup node b x-2
+ Integer response status 204
+
+X2 - Setup Test 2
+ Post Request setup node b x-2
+ Integer response status 204
+
+X2 - Get Nodeb
+ Get Request Node B Enb test1
+ Integer response status 200
+ String response body ranName test1
+ String response body associatedE2tInstanceAddress e2t.att.com:38000
+
+prepare logs for tests
+ Remove log files
+ Save logs
+
+X2 - RAN Connected message going to be sent
+ ${result} find_rmr_message.verify_logs ${EXECDIR} ${e2mgr_log_filename} ${RAN_CONNECTED_message_type} ${Meid_test1}
+ Should Be Equal As Strings ${result} True
+
+RSM RESOURCE STATUS REQUEST message sent
+ ${result} find_rmr_message.verify_logs ${EXECDIR} ${rsm_log_filename} ${RIC_RES_STATUS_REQ_message_type_successfully_sent} ${RAN_NAME_test1}
+ Should Be Equal As Strings ${result} True
+
+Verify RSM RAN info exists in redis
+ ${result}= rsmscripts.verify_rsm_ran_info_start_false
+ Should Be Equal As Strings ${result} True
+
+Verify RAN is associated with E2T instance
+ ${result} e2mdbscripts.verify_ran_is_associated_with_e2t_instance test1 e2t.att.com:38000
+ Should Be True ${result}
--- /dev/null
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+
+*** 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 ../Scripts/e2mdbscripts.py
+Library REST ${url}
+
+*** Test Cases ***
+X2 - Setup Test 1
+ Post Request setup node b x-2
+ Integer response status 204
+
+Restart Simulator
+ Restart Simulator
+
+Verify RAN is NOT associated with E2T instance
+ ${result} e2mdbscripts.verify_ran_is_associated_with_e2t_instance test1 e2t.att.com:38000
+ Should Be True ${result} == False
+
+
+X2 - Setup Test 2
+ Post Request setup node b x-2
+ Integer response status 204
+
+X2 - Get Nodeb
+ Get Request Node B Enb test1
+ Integer response status 200
+ String response body ranName test1
+ String response body associatedE2tInstanceAddress e2t.att.com:38000
+
+prepare logs for tests
+ Remove log files
+ Save logs
+
+X2 - RAN Connected message going to be sent
+ ${result} find_rmr_message.verify_logs ${EXECDIR} ${e2mgr_log_filename} ${RAN_CONNECTED_message_type} ${Meid_test1}
+ Should Be Equal As Strings ${result} True
+
+RSM RESOURCE STATUS REQUEST message sent
+ ${result} find_rmr_message.verify_logs ${EXECDIR} ${rsm_log_filename} ${RIC_RES_STATUS_REQ_message_type_successfully_sent} ${RAN_NAME_test1}
+ Should Be Equal As Strings ${result} True
+
+Verify RSM RAN info exists in redis
+ ${result}= rsmscripts.verify_rsm_ran_info_start_false
+ Should Be Equal As Strings ${result} True
+
+Verify RAN is associated with E2T instance
+ ${result} e2mdbscripts.verify_ran_is_associated_with_e2t_instance test1 e2t.att.com:38000
+ Should Be True ${result}
ranSetupManagerMock.AssertNotCalled(t, "ExecuteSetup")
}
+func TestSetupExistingRanWithAssocE2TInstanceExecuteSetupRmrError(t *testing.T) {
+ readerMock, writerMock, handler, e2tInstancesManagerMock, ranSetupManagerMock := initSetupRequestTest(t, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
+ nb := &entities.NodebInfo{RanName: RanName, AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED}
+ readerMock.On("GetNodeb", RanName).Return(nb , nil)
+ updatedNb := *nb
+ updatedNb.ConnectionAttempts = 0
+ writerMock.On("UpdateNodebInfo", &updatedNb).Return(nil)
+ ranSetupManagerMock.On("ExecuteSetup", &updatedNb, entities.ConnectionStatus_CONNECTED).Return(e2managererrors.NewRmrError())
+ _, err := handler.Handle(models.SetupRequest{"127.0.0.1", 8080, RanName,})
+ assert.IsType(t, &e2managererrors.RmrError{}, err)
+ e2tInstancesManagerMock.AssertNotCalled(t, "SelectE2TInstance")
+ e2tInstancesManagerMock.AssertNotCalled(t, "AssociateRan")
+}
+
func TestSetupExistingRanWithAssocE2TInstanceConnectedSuccess(t *testing.T) {
readerMock, writerMock, handler, e2tInstancesManagerMock, ranSetupManagerMock := initSetupRequestTest(t, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
nb := &entities.NodebInfo{RanName: RanName, AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED}