| /////////////////////////////////////////////////////////////////////////////// |
| // |
| // 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: XTDP_OldTestPortDemo.ttcn |
| // Rev: <RnXnn> |
| // Prodnr: CNL 11 |
| // Updated: 2009-10-16 |
| // Contact: http://ttcn.ericsson.se |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: XTDP_OldTestPortDemo |
| // |
| // Purpose: |
| // This module provides |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // Laszlo Skumat (ELSZSKU) |
| // |
| // Last Review Date: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module XTDP_OldTestPortDemo |
| { |
| import from XTDP_EncDecFunctions all |
| //import from www_mozilla_org_keymaster_gatekeeper_there_is_only_xul all; |
| //import from ttcn_ericsson_se_xtdp_xtdp_1_0 all |
| //import from ttcn_ericsson_se_xtdp_xul_1_0 all |
| import from NoTargetNamespace all; |
| //import from IPL4asp_PortType all; |
| import from IPL4asp_Types all; |
| //import from IPL4asp_Functions all; |
| import from XTDP_Templates all; |
| import from TCCDateTime_Functions all; |
| import from XTDP_OldTestPortDemoAndTest_Common all |
| |
| |
| |
| type record of charstring CHARSTRINGS; |
| const integer c_max_cg_row :=19; |
| const CHARSTRINGS leds := { |
| "[led:green]<green led> ", |
| "[led:blue]" & "<blue led>", |
| "[led:black]" & "<black led>", |
| "[led:yellow]" & "<yellow led>", |
| "[led:red]" & "<red led>" |
| } |
| |
| function f_init_CG_stats(in integer pl_connId) runs on MTC { |
| // init call group stats table with blue leds |
| var integer row; |
| var charstring widget, groupName; |
| widget := "call_group_status_table."; |
| |
| for (row := 0; row <= c_max_cg_row ; row:= row+1 ) { |
| groupName := "Groups with line index #" & int2str(row); |
| |
| f_send(pl_connId,t_singleRqPutValueToStr(f_getNextReqId(), widget & int2str(row) & ".0", groupName)); |
| } |
| |
| var integer offset1:=0, offset2:=0, offset3:=0, offset4:=0; |
| //filling up call groups name |
| var integer i:=0; |
| var integer led_index := 0; |
| for (i:=0; i < tsp_callGrpsNo; i:=i+1) { |
| if (tsp_debugVerbose_GuiTest) {log("Setting tooltip for call group #",i);} |
| |
| if(i mod 4 == 0) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset1) & ".1", "Dummy_OUTG_STA" & int2str(i))); |
| f_send(pl_connId,t_singleRqPutValueToLedWithText(f_getNextReqId(), widget & int2str(offset1) & ".1", leds[led_index])); |
| offset1 := offset1 + 1; |
| } |
| else if(i mod 4 == 1) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset2) & ".2", "Dummy_INCO_STA" & int2str(i))); |
| f_send(pl_connId,t_singleRqPutValueToLedWithText(f_getNextReqId(), widget & int2str(offset2) & ".2", leds[led_index])); |
| offset2 := offset2 + 1; |
| } |
| else if (i mod 4 == 2) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset3) & ".3", "Dummy_OUTG_DYN" & int2str(i))); |
| f_send(pl_connId,t_singleRqPutValueToLedWithText(f_getNextReqId(), widget & int2str(offset3) & ".3", leds[led_index])); |
| offset3 := offset3 + 1; |
| } |
| else if (i mod 4 == 3) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset4) & ".4", "Dummy_INCO_DYN" & int2str(i))); |
| f_send(pl_connId,t_singleRqPutValueToLedWithText(f_getNextReqId(), widget & int2str(offset4) & ".4", leds[led_index])); |
| offset4 := offset4 + 1; |
| } |
| |
| led_index := led_index + 1; |
| if(led_index == sizeof(leds)) { |
| led_index := 0; |
| } |
| } |
| |
| //filling up unallocated call groups name |
| for (i:=0; i < tsp_sigLinksNo; i := i + 1) { |
| if (tsp_debug_GuiTest) {log("Setting unalloc tooltip for siglink #", i);} |
| if(i mod 4 == 0) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset1) & ".1", "Unallocated CICs on Sig.Link.#" & int2str(i))); |
| offset1 := offset1 + 1; |
| } |
| else if(i mod 4 == 1) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset2) & ".2","Unallocated CICs on Sig.Link.#" & int2str(i))); |
| offset2 := offset2 + 1; |
| } |
| else if (i mod 4 == 2) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset3) & ".3", "Unallocated CICs on Sig.Link.#" & int2str(i))); |
| offset3 := offset3 + 1; |
| } |
| else if(i mod 4 == 3) |
| { |
| f_send(pl_connId,t_setTooltipForStatusLed(f_getNextReqId(), widget & int2str(offset4) & ".4", "Unallocated CICs on Sig.Link.#" & int2str(i))); |
| offset4 := offset4 + 1; |
| } |
| } |
| |
| } |
| |
| //NOTE: launch the GUI with SS7LoadGenUI.xul for this test! |
| testcase tc_oldXtdpTP_testGui() runs on MTC{ |
| var XTDP_Message vl_msg; |
| var integer vl_connId; |
| var default handlegui; |
| |
| vl_connId := f_connectToServerGui(tsp_xtdp_connectTo_addr, tsp_xtdp_connectTo_port); |
| handlegui := activate(get_xtdp_message(vl_connId)); |
| |
| f_send(vl_connId, t_XTDP_layoutRequest(f_getNextReqId())) |
| f_wait4RecvFrom(vl_connId); |
| |
| f_init_CG_stats(vl_connId) |
| |
| f_send(vl_connId, t_enableWidget(f_getNextReqId(), "start_test", pushButton)); |
| f_send(vl_connId, t_enableWidget(f_getNextReqId(), "exit_ttcn", pushButton)); |
| |
| |
| timer consoleTimer := 0.1; |
| timer ledblinkingTimer := 1.5; |
| |
| action("Sending values to Stats/Signalling link status/Originating static link..."); |
| f_send(vl_connId, t_singleRqPutValueToInt(f_getNextReqId(), "orig_stat_signalling_link_status_table.0.0", int2str(0))); |
| f_send(vl_connId, t_singleRqPutValueToInt(f_getNextReqId(), "orig_stat_signalling_link_status_table.0.2", int2str(2))); |
| |
| action("Sending intentionally malformed value to cell 0.1"); |
| f_send(vl_connId, t_singleRqPutValueToStr(f_getNextReqId(), "orig_stat_signalling_link_status_table.0.1", "intentionally_malformed")); |
| |
| |
| ledblinkingTimer.start; |
| ledblinkingTimer.timeout; |
| action("Press 'Start test' button on GUI and check console log and Stats/Call group stats!"); |
| |
| var integer lineNumber := 0; |
| var integer led_index := 0; |
| var boolean stopped := true; |
| var ASP_RecvFrom vl_recv; |
| var ASP_Event vl_event; |
| |
| alt { |
| [] IPL4.receive(t_recvfrom(vl_connId)) -> value vl_recv { |
| log("Communication ASP received: ",vl_recv) |
| setverdict(pass); |
| var integer vl_result:= dec_XTDP_Message(f_XTDP_getRawMsg(vl_recv.msg), vl_msg); |
| if (vl_result ==0 ) { |
| log("Decoded msg:", vl_msg, " result:", vl_result) |
| setverdict(pass); |
| } else { |
| log("Unsuccesful decode:", vl_msg, " result:", vl_result) |
| setverdict(fail); |
| } |
| select (vl_msg) { |
| case (t_exitTTCNButtonPressed(pl_rqId:=?, pl_wtype:=string, pl_argument:=?, pl_timeout:=*)) { |
| if (tsp_debug_GuiTest) {action("ExitTTCN button pressed...")}; |
| f_send(vl_connId, t_disableWidget(f_getNextReqId(), "start_test", pushButton)); |
| f_send(vl_connId, t_disableWidget(f_getNextReqId(), "stop_test", pushButton)); |
| f_send(vl_connId, t_disableWidget(f_getNextReqId(), "snapshot", pushButton)); |
| f_send(vl_connId, t_disableWidget(f_getNextReqId(), "exit_ttcn", pushButton)); |
| f_sayByeAndCloseWithStop(vl_connId) |
| } |
| case (t_starttestButtonPressed(pl_rqId:=?, pl_wtype:=string, pl_argument:="Start test", pl_timeout:=*)) { |
| if (tsp_debug_GuiTest) {action("Start test button pressed...")}; |
| f_send(vl_connId, t_disableWidget(f_getNextReqId(), "start_test", pushButton)); |
| f_send(vl_connId, t_enableWidget(f_getNextReqId(), "stop_test", pushButton)); |
| f_send(vl_connId, t_enableWidget(f_getNextReqId(), "snapshot", pushButton)); |
| stopped := false; |
| if (consoleTimer.running) { |
| consoleTimer.stop; |
| } |
| consoleTimer.start; |
| if (ledblinkingTimer.running) { |
| ledblinkingTimer.stop; |
| } |
| ledblinkingTimer.start; |
| repeat; |
| } |
| //egbozie: Note: GUI send widget type "string" for pushbutton, which is nonsense, but true for at least GUI R9A |
| case (t_stoptestButtonPressed(pl_rqId:=?, pl_wtype:=string, pl_argument:="Stop test", pl_timeout:=*)) { |
| if (tsp_debug_GuiTest) {action("Stop test button pressed...")}; |
| f_send(vl_connId, t_enableWidget(f_getNextReqId(), "start_test", pushButton)); |
| f_send(vl_connId, t_disableWidget(f_getNextReqId(), "stop_test", pushButton)); |
| f_send(vl_connId, t_disableWidget(f_getNextReqId(), "snapshot", pushButton)); |
| stopped := true; |
| if (consoleTimer.running) { |
| consoleTimer.stop; |
| } |
| if (ledblinkingTimer.running) { |
| ledblinkingTimer.stop; |
| } |
| repeat; |
| } |
| case (t_snapshotButtonPressed(pl_rqId:=?,pl_wtype:=string, pl_argument:=?, pl_timeout:=*)) { |
| if (tsp_debug_GuiTest) {action("Snapshot button pressed...")}; |
| repeat; |
| } |
| case else { |
| action(log2str("Unhandled message:", vl_msg)); |
| log("Oops: ", match(vl_msg,t_starttestButtonPressed(pl_rqId:=?, pl_wtype:=string, pl_argument:="Start test", pl_timeout:=*))) |
| repeat; |
| } |
| }//select |
| }//alternative |
| [not stopped] consoleTimer.timeout { |
| f_send(vl_connId, t_singleRqPutValueToStr(f_getNextReqId(), "console", "Written console line: #" & int2str(lineNumber))); |
| lineNumber := lineNumber + 1; |
| consoleTimer.start; |
| repeat; |
| } |
| [not stopped] ledblinkingTimer.timeout { |
| // Change the color of the 1st LED |
| f_send(vl_connId, t_singleRqPutValueToLedWithText(f_getNextReqId(), "call_group_status_table.0.1", leds[led_index])); |
| led_index := led_index + 1; |
| if (led_index>4) { |
| led_index := 0; |
| } |
| ledblinkingTimer.start; |
| repeat; |
| } |
| } |
| f_sayByeAndCloseWithStop(vl_connId) |
| } |
| |
| //NOTE: launch the GUI with XTDP_MultiGuiTest.xul for this test! |
| testcase tc_oldXtdpTP_multiGUITest() runs on MTC { |
| |
| var integer vl_serverConnId := f_listenForClientGui(tsp_xtdp_listenAt_addr, tsp_xtdp_listenAt_port) |
| ; |
| timer t1 := 1.0; t1.start; |
| timer t2 := 0.5; t2.start; |
| timer tGuard := 30.0 |
| |
| var integer vl_counter := 0; |
| var XTDP_Message vl_message; |
| var ASP_Event vl_event ; |
| |
| var integer vl_decodeResult := -1 |
| |
| tGuard.start; |
| alt { |
| []as_connOpen(tGuard, newConnId) { |
| log("New GUI connection: ", newConnId); |
| xtdp_connection_list[sizeof(xtdp_connection_list)] := valueof(newConnId); |
| xtdp_connection_defaultlist[sizeof(xtdp_connection_defaultlist)] := activate(as_any(newConnId)); |
| newConnId := ?; |
| tGuard.start |
| repeat |
| } |
| [] as_connClose(tGuard, newConnId) { |
| log("GUI connection closed: ", newConnId); |
| var IntegerList vl_newList := {}; |
| var DefaultList vl_newDefaultList := {}; |
| for(var integer i := 0; i < sizeof(xtdp_connection_list); i := i + 1) { |
| if(valueof(newConnId)!= xtdp_connection_list[i]) { |
| vl_newList[sizeof(vl_newList)] := xtdp_connection_list[i]; |
| vl_newDefaultList[sizeof(vl_newDefaultList)] := xtdp_connection_defaultlist[i] |
| } else { |
| deactivate(xtdp_connection_defaultlist[i]); |
| log("Removed client ", newConnId, " from the connection list."); |
| } |
| } |
| xtdp_connection_list := vl_newList; |
| xtdp_connection_defaultlist := vl_newDefaultList; |
| tGuard.start |
| newConnId := ?; |
| repeat |
| } |
| [] as_recvFrom(newConnId, tGuard, vl_decodeResult) { |
| log("Received msg from conn #", newConnId); |
| newConnId := ?; |
| tGuard.start |
| repeat |
| } |
| [] as_result(newConnId, tGuard, vl_event) { |
| log("Got result ASP for conn #", newConnId, ": ", vl_event); |
| newConnId := ?; |
| repeat |
| } |
| [] as_any(newConnId) { |
| log("Unhandled message received on conn #", newConnId); |
| newConnId := ?; |
| repeat; |
| } |
| [] t1.timeout { |
| for(var integer i := 0; i < sizeof(xtdp_connection_list); i := i + 1) { |
| vl_message := { |
| noNamespaceSchemaLocation := "XTDP-Message.xsd", |
| choice := { |
| xTDP_Requests := {xTDP_Request_list :={ |
| {requestId := f_getNextReqId(), |
| widget := { |
| widgetId := "Table_1.0.1", |
| widgetType := string |
| }, |
| action_ := put, |
| argument := f_getTimeFormatted(f_time(), "%H:%M:%S - %A %d of %B, %Y"), |
| argumentList := omit, |
| timeout_ := omit |
| } |
| } |
| } |
| } |
| } |
| f_send(xtdp_connection_list[i], vl_message) |
| |
| } |
| t1.start; |
| repeat; |
| } |
| [] t2.timeout { |
| for(var integer c := 0; c < sizeof(xtdp_connection_list); c := c + 1) { |
| vl_message := { |
| noNamespaceSchemaLocation := "XTDP-Message.xsd", |
| choice := { |
| xTDP_Requests := {xTDP_Request_list :={}}}} |
| |
| for(var integer i := 1; i < 5; i := i + 1) { |
| var charstring table := "Table_" & int2str(i); |
| for(var integer row := 1; row < 10; row := row + 1) { |
| vl_message.choice.xTDP_Requests.xTDP_Request_list[ |
| sizeof(vl_message.choice.xTDP_Requests.xTDP_Request_list) |
| ]:= { |
| requestId := f_getNextReqId(), |
| widget := { |
| widgetId := table & "." & int2str(row) & ".1", |
| widgetType := string |
| }, |
| action_ := put, |
| argument := table & "." & int2str(row) & ".1 update #" & int2str(vl_counter), |
| argumentList := omit, |
| timeout_ := omit |
| } |
| } |
| } |
| f_send(xtdp_connection_list[c], vl_message) |
| } |
| |
| vl_counter := vl_counter + 1; |
| |
| t2.start; |
| repeat; |
| |
| } |
| } |
| |
| // end -> send bye |
| f_sayBye(vl_serverConnId) |
| |
| // wait 1 sec before GUI port unmap |
| timer t := 1.0; t.start; t.timeout; |
| |
| f_close(vl_serverConnId) |
| unmap(self:IPL4, system:IPL4); |
| |
| setverdict(pass); |
| } |
| |
| } // end of module |