Scripting - Service Control
Scripting - Service Control
Service Control
The Service Control tool is used to compose scripts that automate service testing – PS as well
as CS. Scripting guarantees consistency of measurements, with tests being executed in a
uniform and rigorously controlled manner. Scripts also allow you to create advanced testing
setups that would be awkward or impossible to manage by operating devices manually.
Data service testing encompasses the following services and protocols: Email, FTP, HTTP, MMS,
Ping, SIP, SMS, TCP, Traceroute, UDP, video streaming, VoIP, and WAP. Which of these are
testable for particular cellular technologies is tabulated in section "Supported Services by Cellular
Technology". With multiple devices activated, multiple data connections can be maintained
concurrently.
Scanning can be scripted for all devices indicated in the introduction of chapter "Scanning: General".
for recording data collected while executing the scripts. The recordings will be regular logfiles
(extension .trp).
for applying various control functions to devices, such as RAT lock and band lock
for AT commands.
The Service Control Script Designer window is where you compose service control workflows
(scripts) and available in a window in TEMS Investigation but also as a standalone
application, Service Control Script Designer, accessable from Windows Start Menu:
The Activity pane is a palette holding all script building blocks: for running services, for controlling
devices, and for execution flow control.
The Workflow pane is the area where you assemble your script graphically in the form of a flowchart.
The Properties pane contains properties of the activity that you are currently working with (the one
currently selected in the Workflow pane).
In the Configuration Sets pane you define various entities that can be reused in any script, for
example all the details of accessing a particular FTP server.
In the Properties and Configuration Sets panes, items can either be grouped into categories or
be listed in alphabetical order; use the buttons at the top to toggle between the two display
modes. At the bottom of each pane is a box showing an explanation for the item currently
selected.
The rest of this chapter is organized as follows. First comes a hands -on tutorial on how to build
and run scripts, with numerous screenshots and examples (sections "Basics of Creating
Scripts (with Voice)"–"Running Scripts"). Next, some additional features of the Service Control
tool are covered (sections "General Activity Properties"–"Further Functionality in the Service
Control Designer Window"). Finally, there follows a reference part cataloging all script activity
types with their properties and associated configuration sets (sections "Activities: Reference
Sections"–"Voice Activities").
This section covers the fundamentals of creating a complete and valid script that is ready to be
run. For purposes of illustration we will build a very simple script that dials single voice calls.
Video calls are handled in similar fashion.
Add a voice dial activity to the script. To this end, expand the Voice node in the Activity pane and drag
the "Dial" item to the empty workflow. (The cross-reference here, just like others that follow, points to
the reference sections "Activities: Reference Sections"–"Voice Activities".)
The Dial box is tagged by an exclamation mark. This means that the activity is not yet properly
configured. A similar exclamation mark in the Properties pane indicates the property that is
undefined: "Configuration".
What we need to do is to define a configuration set for the Dial activity. This is done in
the Configuration Sets pane. For a voice dial, the configuration consists simply of the phone
number to call. (In other cases it can be more complex, as will be seen later.)
Give the configuration a suitable name, such as one identifying the subscription having this number.
The example below uses a neutral designation "Voice Call Recipient 1", for which you will probably
want to substitute something more specific.
The Properties and Workflow panes are now updated with the configuration data.
When just dialing a call like this, it will not have a duration. The call will be established and
then immediately hung up (since the script has run to completion). To give duration to a call,
use the "Wait" activity: compare section "Wait".
Drag the Wait activity to a position just below the voice dial box. The graphical user interface helps you
position the Wait box correctly by means of guiding symbols and text.
This section shows how to set up a network connection, which is a necessary preparation for
running data services.
Expand the IP node in the Activity pane and add a "Network Connect" activity to the script.
Once you have the configuration down, point to it from the Configuration field in the activity properties.
Later on, if you have multiple network connect configurations defined, you can pick and choose
among them.
In this section, we will set up an FTP download as an example of a dat a service activity. We
will use the data connection configuration created in section "Setting Up a Network
Connection".
First add a "Network Connect" activity. Associate it with the "Test Config 1" configuration set created in
section "Setting Up a Network Connection".
Then add a "Network Disconnect" activity at the bottom of the workflow. The disconnect operation will
take down the network connection. This activity needs no particular configuration, so you do not
need to associate it with a configuration set.
The FTP session itself is handled by the "FTP Download" activity. Insert an activity of this type between
network connect and disconnect:
For the FTP Download activity, you need to create a configuration set representing the FTP server and
how to access it. Again this is done in similar fashion as for previously created configurations.
After completing the definition of the FTP server configuration, reference it from the FTP Download
activity in the same manner as before.
In this section we will perform explicit PS attach and detach operations in isolation. One
reason for doing this could be to measure the time taken by these operations, particularly for
the purpose of computing KPIs. We will reuse the configuration sets an d activities from
sections "Setting Up a Network Connection" and "Setting Up a Data Service Activity".
We begin with the FTP download workflow from section "Setting Up a Data Service Activity".
At the start of this workflow, add a "PS Detach" and a "PS Attach" activity, in that order (they are found
in the IP category). This will detach the device from the PS network and then reattach the device.
See also section "Snippets".
52.7 Snippets
A snippet is a fixed sequence of activities that is defined as a building block and can be reused
as such, saving time and effort when creating new scripts.
Predefined snippets for all supported services are provided in the Activity pane. For an
example of such a predefined snippet in use, see section "Parallel Activities".
The predefined snippets are also tailored to produce all data required to compute KPIs. (The
KPI computation itself is done in TEMS Discovery Device.) Compare c hapter "Key Performance
Indicators – KPIs".
You can also save an arbitrary activity sequence as a user -defined snippet:
Select all of the activities by dragging the mouse pointer, then enter the File menu and select Save as
Snippet. You are prompted to name and describe the snippet.
The Control Flow node in the Activity pane contains a number of logical constructs and timers
for controlling the script execution flow.
52.8.1 Sequences
You can formally define a group of activities in a script as a sequence. This is handy if you
want to apply some operation to all of these activities – for example, to enable or disable them.
Suppose your script includes PS detach followed by PS attach as described in section "Stand-alone PS
Attach and Detach". Suppose further that you want a convenient means of turning the detach/attach
activities on and off. You can then encapsulate the PS Detach and PS Attach activities within a
sequence.
Expand the Control Flow node and from it drag a "Sequence" activity to a position immediately above
the PS Detach activity:
Select the PS Detach and PS Attach activities by holding Ctrl and clicking each activity, then drag them
both (using the PS Detach box as handle) into the sequenceActivity1 box. You can now enable and
disable the detach–attach sequence as a whole:
Compare section "Suppressing Parts of a Script". For full details on the Sequence activity, see
section "Sequence".
First add a "Network Connect" activity, and then an "FTP Download" activity with the Abort property set
to On Event and "Handover from UTRAN" selected as event type:
For the right-hand branch ("ifElseBranchActivity2"), set Condition Type to Any. This always
evaluates to true, so that the right-hand branch will be executed whenever the condition in the
left-hand branch is false. (Not shown in the screenshot below.)
Add a voice dial activity on the left (to the node "sequenceActivity1") and a streaming activity on the
right (to the node "sequenceActivity2"), as described in the introduction of this subsection. This is
done just as in sections "Basics of Creating Scripts (with Voice)" and "Setting Up a Data Service
Activity" and is not detailed here.
In the Properties pane, set the number of times you want to iterate the while loop. Below, by entering
the value 5, we stipulate that the loop should be run five times in total.
Now drag the predefined FTP download snippet into the while loop, dropping it onto "sequenceActivity1"
in the indicated spot ("Drop Activities Here"):
It may be desirable to insert a brief pause after each pass through the while loop. You can accomplish
this by appending a "Wait" activity at the end of the FTP snippet:
Set the duration of the wait in the Properties pane:
For example, if you set Duration to 10 s, the script will perform five FTP downloads in
succession with a 10 s idle interval between downloads.
First add a "While" activity and set it to run 10 times. This will become an outer loop repeating the
various activities that will be included in it.
Remove "sequenceActivity1" by selecting it and pressing Delete. (The Sequence activity is created
automatically, but in this case we do not need it at the topmost level – compare the steps that
follow.)
Since the Parallel construct by default provides only two branches, we need to add one more. To this
end, right-click the "parallelActivity1" box and choose Add Branch from the context menu. The
structure is now expanded with a third branch:
It is now time to define the service-related activities. Let us begin with the voice calls:
Add while loops to branches 2 and 3 and set each to execute 5 times.
Add a voice call snippet (a predefined one is found in the Activity pane) to each while loop. Set the wait
time to 10 seconds.
To assign the activities to the correct devices, we need to change the equipment (EQ) parameter
to EQ2 and EQ3 in branch 2 and branch 3 respectively. This is done in the Properties pane or from
the context menu for each activity.
After these steps, branches 2 and 3 of the workflow should have the following structure:
Next, define the FTP task for device no. 1. All you need to do here is to add an FTP download snippet
to branch 1 and associate it with a functional configuration.
In the screenshot that follows, the voice sequences have been collapsed to make the overall
structure of the workflow clearer.
This script will conduct a total of 10 FTP downloads and 2x5x10 = 100 voice calls.
When assigning multiple scanning activities to the same device, it is best not to start all of the
scans at the exact same time. Insert short waits as appropriate to stagger the start times, as
exemplified in the following screenshot (branch 1: no Wait; branch 2: Wait with duration 2 s;
branch 3: Wait with duration 4 s). Compare the similar advice in section "Example 2:
Concurrent Activities on Different Devices".
52.8.5 Wait
The "Wait" activity basically does nothing, and it temporarily halts the execution of the
workflow branch it is located in – for all devices, not just the device the Wait is assigned to.
After the wait time has expired, the execution proceeds to the next activity.
When following a (voice) Dial, Video Dial, or Start ... Scan activity, the Wait has the apparent
effect of giving duration to that activity, and this construction is the most convenient method of
controlling the duration. The Wait activity also comes in useful whenever some tasks need to
be cleanly separated in time for one reason or other.
For some usage examples, see sections "Basics of Creating Scripts (with Voice)" , "While
Loops", "Example 2: Concurrent Activities on Different Devices" , and "Notes on Script-
controlled Logfile Recording".
Wait for a scheduled point in time. The schedule can be set up in a number of ways. See
section "Waiting For a Scheduled Point in Time" below.
Wait for another activity to finish with a predetermined outcome. See section "Waiting For a Given
Outcome of an Activity1".
Wait for a particular kind of event to occur. This is straightforward; see the reference section "Wait
For" for the fine points. A special case is Wait For with periodic events: see section "Wait For with
Periodic Events".
Create a "While" loop and set its termination condition to whatever you like.
At the top of the loop, put a "Wait For" with Trigger = Schedule.
If you just want to start the dialing as soon as the script starts, set Start to Immediately.
You can also specify that the calls should begin, for example, at the turn of the hour ("On the
Hour") or at an arbitrary time ("Time of Day").
To make the loop execute with the desired frequency, continue by setting Repeat to Yes and Repeat
Interval to 10 minutes. The loop will then pause at the Wait For activity each time until 10 minutes
have passed since the previous turn. This pattern will repeat until the while loop terminates.
Add activities for the voice call ("Dial", "Wait", "Hang Up") just as in section "Basics of Creating Scripts
(with Voice)". In the screenshots below, the call duration has been set to 2 minutes.
Left: While loop controlled by "Wait For" with Start = Immediately.
Right: While loop controlled by "Wait For" with Start = Time of Day.
Again taking CS voice as a simple use case, suppose that the voice service is tested by dialing
one call after another. If a call proceeds normally, we do not log any data, but if a call is
blocked, we want to start a logfile recording to capture what happens over the following one -
minute period.
In the right-hand branch, put a "Wait For" activity at the top monitoring the voice calls. Set
the Trigger property to Activity Result and stipulate that it should equal "Stopped by Event". Then
add activities for logfile recording beneath the Wait For: "Start Recording" followed by a "Wait" with
Duration = 1 min and finally "Stop Recording".
If any call failures are of interest, and not only blocks, then set Activity Result to the catch-all
value "Failed" instead. Recording will then be triggered by any voice call that does not
complete normally.
Note: If the Wait For activity is placed inside a While loop, the activity that it is waiting for must
be placed inside the same loop.
We can then construct a user-defined event for the condition and make that event periodic,
which means that it is generated repeatedly at fixed intervals as long as the condition is true
(see section "Setting Up a User-defined Event").
Next, a script is written containing a while loop, at the start of which a "Wait For" activity listens
for the periodic event. The rest of the loop contai ns the task to be performed.
If and when the periodic event is generated, the execution will proceed through the rest of the
while loop, so that the device performs its task once. Then the execution returns to the Wait
For and waits for the event to be generated again, etc.
Note that user-defined events are prefixed with the string "User Defined:" in the Events drop-
down box. See the image below.
You can move activities around in the workflow by clicking and dragging.
You can also edit workflows using the Cut, Copy, and Paste commands found in
the Edit menu of the Service Control Designer window. The same operations can be performed
from the window toolbar or from the context menu that appears when right -clicking a workflow
item. The editing commands work in standard Windows fa shion.
You can select multiple activities to move, cut, or copy by holding Ctrl and clicking. The activities do not
have to be adjacent in the workflow but can be picked arbitrarily.
If you are selecting a number of consecutive activities and wish to preserve their ordering after they are
moved or pasted, Ctrl-click the activities from top to bottom in the same order as they come in the
workflow.
When dragging a selection to a new position in the sequence, use the topmost activity as handle to
preserve the ordering of activities. (Whatever activity you use as handle will end up on top.)
The destination of a pasted item depends on what, if anything, is currently selected in the workflow:
If an activity fails, you can choose to skip that activity, retry the activity, or terminate the entire script (On
Failure property).
You can have an activity aborted after a fixed length of time, or if a specific event occurs
(Abort property).
Use a preset parameter substitution configuration file to change settings in a script. These settings can be
used with parameter substitution:
• StartRecording
o Prefix
o Subject
o Description
o Tags
o Directory
• Http GET/POST
o URL
• FTP UL/DL
o ServerAddress
• Ping
o RemoteAddress
• Streaming
o Streaming URL
52.11.1 Configuration File
All substitutions are entered into a configuration file located in the TEMS Product Files folder:
%userprofile%\Documents\TEMS Product Files\TEMS
Investigation 25.1\Settings\ParameterSubstitution.txt
%ParameterName%=Substituted value
e.g.
%RecordingPath%=C:\logfiles
The purpose of this feature is to have separate sets of ParameterSubstitution.txt on separate machines,
which could then execute the same script without any changes, but still get their logfiles with a machine
specific Prefix, or their HTTP Get to different URL's etc.
The Script Designer offers a chance to inspect values directly while creating the script. Open the
Parameter Selection dialog by clicking the three dots in the editor.
To Add, Modify, or Remove substitution parameters in the list, click on the Open button.
This opens the ParameterSubtituion.txt file (located in the TEMS Product Files folder stored in the
computers Documents folder) in a text editor where changes can be made and saved.
Once finished, return to the “Parameter Selection” dialog and press the Reload button. Your changes will
be visible in the list.
Note: The editor can only be used to inspect given values, all changes must be made in the configuration
file.
52.12 UE Control Functionality
A number of control functions accessible from the Navigator (Equipment tab, bottom
part, Activities tab: see section "Control Functions") can also be applied in a script in the form
of activities.
For the RAT lock and band lock functions, it must be noted that the script activities are
inevitably more generic in nature than the manual control functions, since when compos ing a
script it is not known what devices the activities will apply to. Therefore, the Band Lock activity
has bands from every supported technology selectable, whereas the manual band lock function
in the Navigator (acting as it does on a specific device o f a well-defined make and model) can
only lock on the bands supported by the device. In conclusion, a UE control activity in a script
can be executed only if the target device is capable of the operation in question. You will be
notified if this is not the case (see section "Validating Scripts" on validation).
The same applies to the "Channel Lock" script activity as compared to the manually applied
Cell Lock control function.
Before a script is run, it needs to be validated to ensure that it is syntactically correct and does
not assign tasks that your devices do not support. For uncomplicated scripts like our first
example in section "Basics of Creating Scripts (with Voice)" , this may seem trivial. However,
when building more complex scripts involving multiple devices and control logic, the validation
becomes a non-trivial issue. Validation is also crucial for UE control functionality (see
section "UE Control Functionality").
A script is automatically validated when you start it. You can also explicitly have a script
validated in advance:
Enter the Script menu and choose Validate. You will be presented with the results.
If the script passes validation, you will receive a notification "Script validation succeeded". The script is
then ready to be run. See section "Running Scripts".
You can run a script either from the Service Control Monitoror from the Service Control
Designer.
The devices involved in a script will execute their assigned activities independently of one another,
except when the devices engage in a service where they interact, and when devices are involved in
different workflow branches that converge. In the latter case, all branches are synchronized before
the execution proceeds past the point of convergence.
How to run only parts of a script is described in section "Suppressing Parts of a Script".
It is possible in the application to run several scripts at the same time; however, this
is not recommended. (The script validation does not extend to such usage.)
When executing a script, the keylock function must not be activated in any of the participating devices. If
it is, the script will not work properly.
If you stop a script while an SMS or MMS message is being transferred, you should wait until the
receiving device has received the message before restarting the script. Otherwise, unpredictable
behavior may result.
52.14.2 Running a Script from the Service Control Monitor
Click the Open Script button and select your script (file
extension .tsc).
52.14.3
Click the Run Script button to start the script.
52.14.4
Click the Stop Script button to stop script execution.
For Wait activities, the Comment string (if defined) is displayed in italics here, helping to distinguish Waits
from each other if the script contains several:
The tab holding the usual contents of the window is now hidden and replaced
by Status and Summary tabs which are identical with those in the Service Control Monitor
(see section "Running a Script from the Service Control Monitor" ).
To re-enable a disabled activity, just set the Enable property to True again.
Name: Name given to the activity. (Only appears for certain non-editable activities such as the "root"
activity at the bottom of the workflow.)
Configuration: Reference to a configuration set of the type associated with this activity. For example,
for "FTP Download", an FTP server configuration set needs to be selected here. The combo box is
populated with all existing configuration sets that fit the activity; if no such configuration set exists,
you need to create one in the Configuration Sets pane.
Enabled: True or False. If set to False, the activity is disabled and will not be performed when the script
is run. This is indicated by the activity being dimmed by a semi-transparent greenish box in the
flowchart.
Abort: This property determines under what conditions the activity will be aborted.
On Timeout: The activity will be aborted after a fixed period of time, unless it has already
completed before that time. What you indicate here is thus a maximum duration for the activity.
On Event: The activity will be aborted if and when one of the specified events occurs; otherwise it
will run to completion.
On Timeout and/or Event: Select this to create a more complex abort condition in the form of a
boolean expression combining On Timeout and On Event criteria as defined above. Additional
fields Condition 1, Operator (AND/OR), and Condition 2 appear for defining the boolean
expression, which can be expanded recursively.
Note that this property is also possessed by the root activity, in which case it applies to the entire script.
Compare the "Terminate" activity, which aborts the whole script with immediate effect.
On Failure: This property determines what will happen if an activity fails (when first attempted).
Stop Script Execution: If an activity fails, the activity is abandoned, and the whole script is
terminated.
Continue Script Execution: If an activity fails, the activity is abandoned, and the execution
proceeds to the next activity in the workflow branch in question.
Retry: If an activity fails, it will be retried. When you choose this option, a set of further parameters
appear: Retries – the number of retries; Delay – the time to wait before each retry; On
Failure – what action to take if all retries fail (continue or stop script).
Copy: Creates a duplicate of the currently displayed configuration set under a new name "New
Configuration #<n>". This is handy if you want to make some minor changes to an existing
configuration.
Rename: Selects the configuration set name in the combo box so that you can type a new name for it.
When you click the Apply button at the bottom of the Configuration Sets pane, the
configuration set with the currently displayed name and settings is saved automatically.
To launch the Settings Manager utility, choose File > Manage Settings.
Alternatively, in Windows, choose Start > All Programs/All apps > TEMS
Investigation 25 > Service Settings.
Select the configuration sets you want to export by clicking them in the list. Shift + click and Ctrl + click
can also be used, in standard Windows fashion. To select/deselect all sets, right-click in the list and
choose Select All/Unselect All.
Now select where to export the configuration sets. Click the Target button and point to the desired
directory.
To perform the export, click the Export button. Each configuration set is now exported as a file named
according to the format TEMS.Services.Settings.<service name>Settings.<...>.config.
Any user names and passwords (e.g. for FTP or HTTP servers) contained in configuration sets
are encrypted in the *.config file. Be aware that anyone making use of the configuration set will
be accessing servers with the same credentials.
Click the Source button and browse to the directory you want to import from. The window is populated
with all configuration sets found in that directory.
Select the configuration sets you want to import by clicking them in the list. Shift + click and Ctrl + click
can also be used. To select/unselect all sets, right-click in the list and choose Select All/Unselect
All.
Please note that it is not possible to import obsolete configuration sets from older TEMS
Investigation versions, for example:
Configuration sets for the VoIP Dial, VoIP Answer, and VoIP Hangup activities found in TEMS
Investigation 14.x.
Configuration sets for scanning from TEMS Investigation 14.0 or older versions.
From the Tools menu you can delete all configuration sets by choosing Clear Settings.
If the Enable Backup option is selected, a backup of the configuration sets will be created
whenever you use the Clear Settings command.
To restore configuration sets from a backup, choose Tools > Manage Backups, select the backup of
interest from the list, and click the Restore button.
Description: Free-text field where you can optionally enter a description of the script.
Format: You can save the script either with or without the configuration sets it uses. Note that
configuration sets can also be saved separately: see section "Managing Configuration Sets from the
Settings Manager".
Standard: No configuration sets are saved with the script. This means that changes to a
configuration set will automatically propagate to all scripts that reference it. Choose this option if
you are going to use the script on one PC only. (This is the default setting.)
Redistributable: All configuration sets referenced in a script are saved with the script, making the
TSC file a self-contained and independent entity that can be immediately reused on a different
PC. Choose this option if you are going to use the script on several PCs.
To open an existing script stored on file, click the Load button on
the Service Control Designer toolbar.
On the "receiver" PC (with the above data from the sender available on some suitable storage medium):
Open the sender's script. The script can now be not only run but also freely modified on the
receiver PC.
You can also save the contents of the workflow pane as an image. To this end, choose File > Save As
Image in the Service Control window and select the desired image file format.
The context menu is especially useful for changing properties (EQ assignment, on -failure
behavior) of several activities at once. This is most conveniently done from the context menu:
Select all of the activities you want to modify by dragging the mouse pointer or by Ctrl + click, then right-
click the selection and choose the desired command from the context menu.
After you click the Zoom In button on the window toolbar, mouse
clicks in the workflow pane will magnify its contents in predefined
steps. You can also click and drag to select a portion of the
workflow pane that you want to enlarge.
To reverse the mouse-click zoom function, click the Zoom
Out button on the window toolbar.
To return the mouse to pointing mode, click the Pointer button.
The sections that follow give full detail on all activities, explaining all activity -specific
properties found in the Properties pane: that is, those not covered in section "General Activity
Properties". Not all activities have unique properties.
52.20.1 Activate
Activates the device so that it can be used in TEMS Investigation.
This has the same effect as manual device activation, described in section "Activating and
Deactivating External Equipment in TEMS Investigation" .
52.20.2 ADB
Sends an Android Debug Bridge command.
ADB Timeout property: Time ("hh:mm:ss") to wait for an ADB response from the device.
ADB Command property: ADB command string with the serial number argument (-s <serial number>)
omitted. Define a configuration for each ADB command you want to send.