| /////////////////////////////////////////////////////////////////////////////// |
| // Copyright (c) 2000-2018 Ericsson Telecom AB |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v2.0 |
| // which accompanies this distribution, and is available at |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html |
| /////////////////////////////////////////////////////////////////////////////// |
| // |
| // File: SGsAP_SCTP_Daemon_Test.ttcn |
| // Description: SGsAP SDD test |
| // Rev: <RnXnn> |
| // Prodnr: CNL 113 630 |
| // Updated: 2010-11-26 |
| // Contact: http://ttcn.ericsson.se |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| |
| module SGsAP_SCTP_Daemon_Test |
| { |
| import from SGsAP_SCTP_Daemon all; |
| import from SGsAP_SCTP_Daemon_Types all; |
| import from SGsAP_Types all; |
| import from SCTP_Daemon_Dynamic_Test all; |
| import from SCTP_Daemon_Dynamic all; |
| import from SCTP_Daemon_Dynamic_Types all; |
| |
| |
| //========================================================================= |
| // Testcases |
| //========================================================================= |
| |
| testcase tc_SGsAP_lookup() runs on SGsAP_SDD_CT |
| { |
| f_SGsAP_SDD_init(); |
| |
| log("Starting inserts"); |
| if (v_Connection_Insert!=null) |
| { |
| v_Connection_Insert.apply('100103AABBCC'O , 5); |
| v_Connection_Insert.apply('100103AABB01'O , 5); |
| v_Connection_Insert.apply('100103DDEEFF'O , 6); |
| v_Connection_Insert.apply('100103999999'O , 7); |
| v_Connection_Insert.apply('100103000000'O , 8); |
| v_Connection_Insert.apply('100103000001'O , 8); |
| } |
| log("Finished inserts"); |
| |
| log("Starting lookUps"); |
| var TCP_connections_List vl_res; |
| if (v_Connection_Lookup!=null) |
| { |
| vl_res := v_Connection_Lookup.apply('100103000001'O); |
| log(vl_res); |
| if (vl_res == {8}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103000000'O); |
| log(vl_res); |
| if (vl_res == {8}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103999999'O); |
| log(vl_res); |
| if (vl_res == {7}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103DDEEFF'O); |
| log(vl_res); |
| if (vl_res == {6}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('100103AABB01'O); |
| log(vl_res); |
| if (vl_res == {5}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103AABBCC'O); |
| log(vl_res); |
| if (vl_res == {5}) { setverdict(pass); } else {setverdict(fail)}; |
| } |
| log("Finished lookUps"); |
| |
| vl_res := f_SGsAP_SDD_getAllConnIds(); |
| log("Get all connIds: ",vl_res); |
| |
| if (vl_res == {5,6,7,8}) { setverdict(pass); } else {setverdict(fail)} |
| |
| log("Starting deletes"); |
| if (v_Connection_Delete!=null) {v_Connection_Delete.apply(8)} |
| log("Finished deletes"); |
| |
| log("Starting lookUps 2"); |
| |
| if (v_Connection_Lookup!=null) |
| { |
| vl_res := v_Connection_Lookup.apply('100103000001'O); |
| log(vl_res); |
| if (vl_res == {}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103000000'O); |
| log(vl_res); |
| if (vl_res == {}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103999999'O); |
| log(vl_res); |
| if (vl_res == {7}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103DDEEFF'O); |
| log(vl_res); |
| if (vl_res == {6}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('100103AABB01'O); |
| log(vl_res); |
| if (vl_res == {5}) { setverdict(pass); } else {setverdict(fail)}; |
| |
| vl_res := v_Connection_Lookup.apply('120103AABBCC'O); |
| log(vl_res); |
| if (vl_res == {5}) { setverdict(pass); } else {setverdict(fail)}; |
| } |
| log("Finished lookUps 2"); |
| |
| vl_res := f_SGsAP_SDD_getAllConnIds(); |
| log("Get all connIds: ",vl_res); |
| |
| if (vl_res == {5,6,7}) { setverdict(pass); } else {setverdict(fail)} |
| |
| f_SGsAP_SDD_cleanUp(); |
| } |
| |
| function f_delay(float p_time) |
| { |
| timer t := p_time; |
| t.start; |
| t.timeout; |
| } |
| |
| type component Dummy_CT {} |
| |
| testcase tc_SGsAP_client() runs on Dummy_CT |
| { |
| var MAIN_CT vc_server := MAIN_CT.create; |
| var MAIN_CT vc_client := MAIN_CT.create; |
| |
| vc_server.start(f_SGsAP_server()); |
| |
| f_delay(1.0); |
| |
| vc_client.start(f_SGsAP_client()); |
| |
| all component.done; |
| } |
| |
| function f_SGsAP_client() runs on MAIN_CT |
| { |
| map(self:daemonPort, system:daemonPort); |
| |
| f_Connect_to_SDD(); |
| |
| f_Init_SCTP_Client(tsp_serverInterface, tsp_serverPort); |
| |
| f_sendDataFromClient('100103AABBCC'O); |
| f_CheckDataReceive_noOtherData(?,'100103AABBCC'O); |
| f_delay(5.0); |
| |
| f_StopClient(); |
| |
| //f_StopMyAssociations(); |
| |
| unmap(self:daemonPort, system:daemonPort); |
| } |
| |
| function f_SGsAP_server() runs on MAIN_CT |
| { |
| map(self:daemonPort, system:daemonPort); |
| |
| f_Connect_to_SDD(); |
| |
| f_Init_SCTP_Server(tsp_serverInterface, tsp_serverPort); |
| |
| f_serverWaitForConnection(); |
| |
| f_ServerEchoBack(5.0); |
| |
| f_StopServer(); |
| |
| //f_StopMyAssociations(); |
| |
| unmap(self:daemonPort, system:daemonPort); |
| } |
| |
| testcase tc_SGsAP_clients() runs on Dummy_CT |
| { |
| var MAIN_CT vc_server := MAIN_CT.create; |
| var MAIN_CT vc_client := MAIN_CT.create; |
| var MAIN_CT vc_client_2 := MAIN_CT.create; |
| |
| vc_server.start(f_SGsAP_server()); |
| |
| f_delay(1.0); |
| |
| vc_client.start(f_SGsAP_client()); |
| |
| f_delay(1.0); |
| |
| vc_client_2.start(f_SGsAP_client_2()); |
| f_delay(5.0); |
| |
| all component.done; |
| } |
| |
| function f_SGsAP_client_2() runs on MAIN_CT |
| { |
| map(self:daemonPort, system:daemonPort); |
| |
| f_Connect_to_SDD(); |
| |
| f_Init_SCTP_Client(tsp_serverInterface, tsp_serverPort); |
| |
| f_sendDataFromClient('100103999999'O); |
| f_CheckDataReceive_noOtherData(?,'100103999999'O); |
| f_delay(5.0); |
| |
| f_StopClient(); |
| |
| //f_StopMyAssociations(); |
| |
| unmap(self:daemonPort, system:daemonPort); |
| } |
| |
| } |