Académique Documents
Professionnel Documents
Culture Documents
v200R008c03
Issue 02
Date 2010-03-23
Website: http://www.huawei.com
Email: support@huawei.com
and other Huawei trademarks are the property of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their respective holders.
Notice
The purchased products, services and features are stipulated by the contract made between Huawei and the
customer. All or part of the products, services and features described in this document may not be within the
purchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information,
and recommendations in this document are provided "AS IS" without warranties, guarantees or representations
of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made in the
preparation of this document to ensure accuracy of the contents, but all statements, information, and
recommendations in this document do not constitute the warranty of any kind, express or implied.
Contents
2 iSStar Management....................................................................................................................2-1
2.1 iSStar File System...........................................................................................................................................2-2
2.2 iSStar Log Data...............................................................................................................................................2-3
2.3 iSStar Process and Service..............................................................................................................................2-3
2.4 iSStar User Authority Setting..........................................................................................................................2-6
3 iSStar Operation.........................................................................................................................3-1
3.1 iSStar Operation Procedure.............................................................................................................................3-2
3.2 Developing Scripts..........................................................................................................................................3-4
3.2.1 Creating a Script File..............................................................................................................................3-4
3.2.2 Debugging a Script File..........................................................................................................................3-8
3.2.3 Creating a Script Project......................................................................................................................3-12
3.2.4 Debugging a Script Project..................................................................................................................3-14
3.2.5 Creating a Script Application...............................................................................................................3-15
3.3 Using Scripts.................................................................................................................................................3-17
3.3.1 Types and Status of Script Tasks.........................................................................................................3-17
3.3.2 Running a Script File............................................................................................................................3-20
3.3.3 Running a Script Project......................................................................................................................3-22
3.3.4 Running a Script Application...............................................................................................................3-23
3.3.5 Viewing the Result of a Script.............................................................................................................3-25
Figures
Tables
Purpose
This document describes functions and application scenarios of the iSStar and methods to
develop and use scripts with iSStar.
Product Version
The following table lists the product version related to this document.
M2000 V200R008
Intended Audience
The intended audience of this document are:
Update History
02(2010-03-23)
Second formal release
01(2008-12-08)
Initial release. Also, the first formal release.
Brief Introduction
1 iSStar Overview
Being an enhanced tool component of the M2000, Integration Script Star (iSStar) is a powerful
script secondary development platform. The iSStar provides an easy-to-learn programmable
script language - High level Script Language (HSL), powerful High-level Foundation Classes
(HFC), and an integrated development environment for editing, debugging, and executing the
HSL scripts. You can create an HSL script for the repetitive and effort-consuming daily
maintenance. In this way, daily maintenance can be performed automatically through the iSStar
tool. This reduces workload and improves work efficiency.
This describes a sample of querying the CPU load. This sample is provided by the iSStar. By
studying this sample, you can have a preliminary understanding of the structure and framework
of script files and their applications in the business.
1.7 iSStar Technical Specifications
The iSStar technical specifications are operational environment specifications and performance
specifications. The running environment specifications include hardware configuration and
software configuration. The performance specifications include number of local tasks
simultaneously started, number of timed tasks simultaneously started, and size of the script files.
These technical specifications must be met when you use iSStar.
As a powerful secondary development platform, the iSStar has the following features:
l The iSStar provides powerful script program development capability and can flexibly
customize personalized service.
The HSL can be used to write multiple kinds of programs because its syntax is based on
Python. In addition, the HSL has its own data types and functions and has good control
over the MML scripts through compiling. The HSL can customize personalized services
as required for fast service deployment.
l The iSStar provides abundant extendable service functions.
The iSStar provides abundant extendable HSL Foundation Class (HFC). The HFC
encapsulates many complex and similar service implementations into functions. To
compile a script program in the iSStar, you only need to invoke these functions. You can
flexibly extend HFC as required.
l The iSStar provides a comprehensive program debugging mechanism.
The iSStar provides a comprehensive program debugging mechanism. For example, you
can set breakpoints and one-step debugging for the script programs. Thus, you can debug
the program to check whether the program runs properly and can quickly locate the
problems of the program.
l You can compile MML scripts in batches through the iSStar.
By compiling the MML script program, you can conveniently deliver batch MML
commands and can perform batch operations on multiple NEs.
l Script tasks can be automatically executed.
The script programs support manual immediate execution and timing automatic execution.
Tasks that are executed in certain time point or periodically executed can be set as timing
tasks. The script automatically executes these tasks.
l The iSStar provides an user-friendly interface.
You can follow the wizard to edit, compile, and execute scripts. The result of the script
execution is displayed in the monitoring window in real time.
Basic Description
Concepts
Script Programs written in the HSL are used to provide specific service functions.
Basic Description
Concepts
Script file Indicates the text file written by users in the HSL, saved with .hsl as the
extension name. The script is used to implement a specific service function.
Script Indicates the platform for developing service function scripts. The
development development platform provides the functions of managing projects and
platform editing, debugging, and running scripts.
Script Indicates the platform for applying service function scripts. This platform
application provides the function of managing applications.
platform
Users Indicates the person who uses the iSStar. Users are classified into
development users and service users.
l Development users
Users who compile script files and develop service functions. They often
use the script development platform.
l Service users
Those who are concerned with only the execution of scripts and the
implementation of a service function are called service users. Service
users often use the application platform. Service users are also called
application users.
Script project Script projects are used by developers for centrally managing scripts with
associated functions. A group of script files in the development platform are
organized as a project. Each script project corresponds to a script project
file. The extension name of a script project file is .dsl. A script project file
records the information about scripts and the main file of a script project.
The main file is the execution entry for executing and debugging a script
project. A script project is the basis for packing.
Packing Packing is a process for combining all the files in a project into a script
application package. When packing, if you choose not to support the
unpacking function, the implementation details of the service are hidden
from the service users.
Workstation In the iSStar, the tab page of the script application platform interface is called
workspace. You can create workspaces and create script applications in the
workspaces.
Basic Description
Concepts
Script task A script task is a process for executing related script files. A script task
corresponds to an execution of a script file (or script application). Service
functions are implemented through the execution of script tasks.
Script tasks are classified into immediate tasks and timing tasks by the time
of execution. Script tasks are classified into local tasks and remote tasks by
the location of the execution. You can save and perform a local task on a
local computer. You can save and perform a remote task on the server that
is connected to the current client.
The iSStar has the feature of multiple tasks and a thread. The iSStar supports
the concurrent execution of multiple tasks. A task can have only one thread
(that is, multiple threads are not supported). During the execution of a task,
the task can only interact with an NE in a certain time segment.
Background
The OM personnel of the carriers often face the following problems and challenges during their
work:
l The functions provided by the network management system fail to meet the carrier's
requirements for personalized operation and maintenance.
The operation and maintenance service functions of the network management system
provided by the equipment vendor are general functions that meet most carriers'
requirements in most OM scenarios and are tailored to the customers' usage habits. When
a carrier has a personalized and unique OM requirement, the equipment vendor fails to
respond quickly to meet the customer's requirement due to the limits of software
development period and version release period.
l Expansion of the network scale leads to drastic increase of the OM work.
With the business development, the network size expands quickly and the maintenance
work increases accordingly. Operations on NEs one by one cannot meet the challenge. You
can deliver batch instructions to multiple NEs. Implementing a service function can help
improve the OM efficiency.
l Too many manual routine maintenance operations should be performed and some
operations are duplicated.
Some routine important work, such as routine check and data statistic analysis are repetitive
manual operations. They are time-consuming and inefficient.
To solve the preceding problems, Huawei provides the iSStar as a secondary development
platform for expanding the OM service function. Users can compile some OM-related script
programs according to the actual situation, and process the work in batches according to the
preset processing flow to substitute daily maintenance work and improve the maintenance
efficiency.
Routine Check
l Target users:
Staff in the OM team and the monitoring team
l Scenario description
Routine check is a common task in daily OM. You need to check the key operation state
or network parameters of the devices on the existing network. Then, you can identify
whether the device is running properly and can detect the potential or existing faults. By
compiling the iSStar script program, you can send MML commands to the corresponding
NEs to check the operational state of the devices. The generated check report summarizes
and lists the exceptions.
l Reference
<Installation directory on the M2000 client>\script\samples\en\DailyCheck\sample.hsl
Real-Time Monitoring
l Target users:
Staff in the monitoring team
l Scenario Description
You can write an iSStar script about the network monitoring tasks that are required every
day. By irregularly executing or periodically executing the script with a short interval, the
iSStar notifies the operators of the exceptions through alarms or exceptional files. Though
not recommended, the scripts can also be executed circularly. In this way, OM engineers
can obtain the information about the network in real time.
NOTE
The real-time network monitoring provided by iSStar supplements the alarm module on the M2000.
Compared with the alarm module, the monitoring program written by the iSStar is used for specific
purposes.
Data Creation
l Target users:
Softswitch equipment maintenance personnel
l Scenario Description
During the maintenance of softswitch devices, data is frequently modified and created. You
can compile iSStar script programs to automatically generate the data about the analysis of
prefixes, global titles (GTs), and international roaming on multiple NEs.
l In the main window, you can manage multiple script files. The number of script files, however, must
be less than 100.
l Each script is displayed as a tab page. The tab page displays the script name. The information output
area of the window displays the output information of the script file.
Area Description
Tab Displays the currently opened script files and provides script file
management function.
The file management functions include creating, opening, saving,
saving as, closing, and closing all files.
l : cuts a script.
l : copies a script.
l : pastes a script.
l : runs a task. You can also run a specific part of a script file.
l : debugs a task.
CAUTION
l The iSStar allows only one debugging task.
l A maximum of 50 debugging tasks and running tasks can be supported by the iSStar.
Tool bar Provides shortcut icons for debugging operation and switching windows.
Area Description
Output area Displays various information during the debugging of the script file. The
information consists of output information, MML packet information,
stack information, file lists, and variable observation information. For
details, refer to Table 1-4.
Message l The Message tab page displays the system information during the
debugging of the script files. The system information includes script
debugging output information, script running output information, error
information, and syntax check results.
l The output information is exported to Message line by line. When the
number of the lines exceeds 3000, the first 1000 messages are deleted.
l On the Message tab page, right-click the output information to copy,
clear, search, save as, or redirect the output information.
NOTE
Redirection involves saving the script output information to the file under the
specified path. Redirection saves all the output information of the scripts that
have performed the redirection.
MML Response l The MML Response tab page contains the MML commands and
displayed information during the running and debugging of the script
file. If the running commands include commands of follow-up reports,
multiple MML reports with the same ID are returned.
l The MML Response tab page displays a maximum of 3000 message
lines. If the number exceeds the limit, the earliest 1000 messages are
deleted.
l On the MML Response tab page, right-click the output information to
copy, clear, search, save as, and redirect the output information.
NOTE
Redirection means to save the script output information to the file under the
specified path. Redirection saves only all the output information after the
redirection.
File List If the script file invokes other script files, the full path of the invoked script
files will be displayed on the File List tab page.
Stack l When debugging succeeds, the Stack tab page displays the full path
information invoked by the current function.
l The stack information is refreshed as the script file is executed.
Name Description
Watch l The Watch tab page displays the change information of the variables
during the debugging of the script file.
l On the Watch tab page, right-click the variable to be observed to add
or delete it.
NOTE
l The Watch tab page displays a maximum of 32 watched variables.
l If the selected variable has spaces before or after the name, the space(s) is deleted
after being added to the tab.
l The variable name can be copied, modified, and deleted. The variable value
cannot be edited.
l In the display area of iSStar Debug Window, right-click a variable and select
Add to Watch to add a watched variable.
l When you stop debugging, no messages are displayed on Watch.
Tool bar Provides control buttons for executing scripts. The meanings for the
buttons are as follows:
Print output area Displays the output of the print function of the script file.
MML message Displays the MML command and return information during the
output area execution of a script.
MML command Counts and displays the number of MML command deliveries, number
statistic bar of execution successes, and number of execution failures of the script
file.
GUI interactive Displays the GUI interactive controls created after the script file invokes
area the GUI interactive library function for simple interaction with the GUI.
If the script file does not invoke the GUI interactive library function, the
GUI interactive area is not displayed.
You can manage the script applications in the iSStar Application Management window. That
is, you can create, download, release, execute, view, or delete script applications. Figure 1-6
shows the iSStar Application Management window.
Tool bar Displays the shortcut icons for the management of applications.
l : adds a workstation.
l : to add shortcuts.
l : to delete shortcuts.
Local Task tab Click the Local Task tab to view the basic
information and execution results of all the
local script tasks in the system.
NOTE
The files of local tasks are saved and executed on
the local computer.
Remote Task tab Click the Remote Task tab to view the basic
information and execution result of all the
remote script tasks in the system.
NOTE
l The files of remote tasks are saved and executed
on the server.
l By creating remote script tasks, you can share
the services.
Parameter/Tab Description
l Displaying the basic information and execution of all the local and remote tasks of the
system, such as the main file of a task, task type, NE corresponding to the task, task state,
task execution progress, and start time and end time of the task execution.
l Sorts tasks. You can sort the tasks by the fields, such as Script File to quickly locate the
task that you want to view.
l Switching from iSStar Task Manage Window to iSStar Main Window. Click to
switch the window to iSStar Main Window so that you can edit the corresponding script
file as required.
l Controlling tasks, including creating, copying, deleting, running, pausing, resuming, and
stopping a task.
l Viewing the output information of the task, including viewing the print output and MML
output.
compiling of scripts, speed up development of scripts, and improve efficiency of the script
running. The HFC function library can be flexibly expanded. Table 1-9 describes the HFC
function library provided by the iSStar.
MML message parsing function The MML message parsing function parses
MML messages.
Alarm message parsing function The alarm message parsing function parses
alarm messages.
Input and output function The input and output function provides the
input and output function and enables you to
set the output modes.
Function Description
Script Content
The iSStar provides a sample of querying CPU load. The path is <M2000 client installation
directory>\script\samples\en\DailyCheck\. The content is as follows:
####################################--Parameter Setting-begin--
####################################
SampleMML1 = ''' +++ MTS-U 1.0 2008-01-16 10:15:13+08:00 O&M
#131083 %%/*126769*/DSP CPUR: LT=MN;%% RETCODE = 0 Operation succeeded
CPU Performance --------------- Module number Board Type
FrameNo SlotNo CPU rate CPU status
2 WSMU 0 8
36% Normal 3 WSMU 1
8 25% Normal 4 WSMU
2 8 25% Normal 5
WSMU 3 8 15% Normal
22 WCSU 0 1
16% Normal 23 WCCU 0
3 6% Normal 24 WCCU
0 5 56% Normal 25
WCSU 1 0 26% Normal
26 WCCU 1 2
6% Normal 27 WCCU 1
5 6% Normal 28 WCSU
2 1 16% Normal 29
WCCU 2 2 17% Normal
30 WCCU 2 5
16% Normal 31 WCSU 3
0 26% Normal 32 WCCU
3 3 46% Normal 33
WCCU 3 5 36% Normal
(Number of results = 16)
--- END '''
SampleMML2 = ''' DSP FAN: FN=0; CQSSA1 +++ MTS-U 1.0 2007-08-21
11:09:12 O&M #684194 %%/*1160460*/DSP FAN: FN=0;%% RETCODE = 0
Operation succeeded
FAN Information --------------- Hardware PCB version = 0 Software version
= 200 FAN temperature (in Celsius) = 29 FAN speed = Low speed
# Send MML commands to NEs and parse messages to obtain the required
data Print('Begin checking NEs. Please wait......') #In practice, invoke
ConnectNE function to connect to NE #ConnectNE(NEName) ReportList,MMLCmd
= ExecMMLCmd()
# Save Excel report. If the suffix xls is changed to html, HTML report
is generated. RepOutputFile = "C:/Routine check report sample.xls"
SaveReportAs(RepOutputFile)
p = ParseMMLRpt(mml)
SetTableTitleFont(tableID,8,10,0,1) SetTableFont(tableID,8,10,0,0)
for i in range(col) SetCellBGColor(tableID,0,i,20) end return tableID end
# Set column width def setColWidthList(sheetID,widths) for col in range
(len(widths)) SetColumnWidth(sheetID,col,widths[col]) end end
# Write data to Excel report def writeReport(sheetID, tablename,
header, dataset, colwidths=[]) col = len(header) row = len(dataset)
datalst = [] for item in dataset datalst.extend(item) end #row = len
(datalst)/col
tableID = writeTable(sheetID,tablename,row,col,header,datalst) if
colwidths setColWidthList(sheetID,colwidths) end return tableID end
# Get the values of some columns of the MML report def getColsByIdx(p,
obj=0, attridxs=[]) cols = []
and you can read, write, modify, and maintain scripts conveniently.?The CPU load query script
is made up of eight Self-defined functions and multiple HFC library functions. For details of
each function, see the script content. Table 1-10 lists the functions.
Main function The main function of the The main function invokes
script is the execution entry other self-defined functions
of the script and is and HFC library functions to
responsible for organizing provide control of the
other functions and for execution flow of the script.
controlling the execution
flow of the script.
writeReport function Write data to Excel report file This function invokes
and set the display style of the writeTable function and
report. setColWidthList function.
Performance Counters
Table 1-12 shows the performance specifications of iSStar.
Item Range
2 iSStar Management
This describes the iSStar file system, log information, process service information, and rights
required for iSStar operations.
The iSStar client installation package is integrated in the M2000 client installation package. The
iSStar client is installed together with the M2000 client. You can select whether to install the
iSStar during the M2000 installation.
If you choose to install the iSStar when installing the M2000, two iSStar of the online and offline
versions are installed in the system. The differences are as follows:
l The functions are different.
– The online iSStar provides all the functions of iSStar, including creating script
application, interacting with NEs, and sending MML commands.
– The offline iSStar is not capable of creating script application, interacting with NEs,
and sending MML commands.
l The start modes are different.
– The online iSStar is integrated in the M2000 client software. You need to start the
M2000 client software, and then select Maintenance > iSStar > Development
Platform from the M2000 client interface.
– For the offline iSStar, you need to choose Start Menu > iManager M2000 Client >
iSStar tool(offline) or run <M2000 client installation directory>\client_offline
\Run_iScript.bat to start.
l Dependences on the M2000 client are different.
– You need to log in to the M2000 client to use the online iSStar.
– You need not log in to the M2000 to use the offline iSStar.
Directory Description
M2000 client installation directory\client Directory for storing executable files. The
related files of the iSStar script descriptor,
such as python24.dll is saved in the
directory.
M2000 client installation directory\client Storage directory for starting the M2000
\bin client program.
M2000 client installation directory Directory for storing offline iSStar version.
\client_offline
Directory Description
M2000 client installation directory\script Default directory for storing script projects.
\Projects
M2000 client installation directory\client Directory for storing trace files. Some
\tracefile information generated during iSStar
execution is stored in this directory.
Because the iSStar is an enhanced component of the M2000, the M2000 manages the iSStar logs
and monitors the iSStar uniformly. iSStar log data is classified into two types:
l Operation logs: All the operations during the use of the iSStar are recorded in the operation
log of the M2000 network management system. You can view the operation log of the
M2000 network management to know your operations and other people's operations. For
details about viewing the operation log, see M2000 Operator Guide.
l trace file: The running information of the M2000 system, including the iSStar, is stored in
M2000 client installation directory\client\tracefile. You can view this file to know the
running state of the iSStar.
scriptserver_agent Process
When M2000 runs well, the server starts related processes of M2000, each of which includes
different services and provides different functions. The process that is related to the iSStar is
scriptserver_agent.
The scriptserver_agent process provides the ScriptService service. ScriptService provide script
timing and NEs access from script.
The scheduled task management of the iSStar and access to the NEs are normal only when the
scriptserver_agent process and the ScriptServer service are normal.
If the system displays the following information, it indicates that the scriptserver_agent
process runs normally. Otherwise the process is not normal.
Service Agent: scriptserver_agent [1 service(s)] pid: 24468
CmeServer [running ]
If the scriptserver_agent process does not run normally, you can start scriptserver_agent through
the following method:
1. Go to the installation directory of the M2000. The default installation directory is /opt/
OMC.
-bash-3.00$ cd /opt/OMC
2. Run the following command:
# . ./svc_profile.sh
# svc_adm -cmd start ScriptServer
Local operations After owning this right, you can Network management
perform the following application authority
operations:
l Running scripts
l Debugging scripts
l Running a Script Project
l Debugging a Script Project
l Running script project
packages
l Packing script projects
l Create script applications.
l Running a Script Application
l releasing script applications
Timing task operations After owning this right, you can Network management
perform the following application authority
operations:
Creating Scheduled Tasks
3 iSStar Operation
This describes the operation procedure of the iSStar and how to use the iSStar to develop,
manage, or use scripts.
l For some applications, you need to select the NEs before running the applications.
l You can view the script task states and terminate script tasks on the iSStar Task Manage
Window. For details, see Viewing the Script Task States and Stopping a Script Task.
4. View the result
You can view the results on iSStar Execute Window.
Context
A maximum of 100 files are displayed in the iSStar Main Window window. The new script
file is named untitled-number.hsl, where the number increments from 1. For example, the first
file name is untitled-1.hsl, and the second file name is untitled-2.hsl.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
Step 2 Click . Alternatively, right-click the tab bar of the script editing area, and then choose
New.
Step 3 Compile a script in the script editing area. You can edit the script as required during the script
compiling.
Operation Procedure
Cut Select the text to be cut, and then cut the selected text in one of the
following three ways:
Copy Select the text to be copied and copy the selected text in one of the
following three ways:
Paste Position the cursor at the place where you plan to paste. Paste the
text in one of the following three ways:
Operation Procedure
Find Find a specific string in the current script files. You can choose
either of the following two methods:
l Right-click the script editing area, and then choose Find.
l Press Ctrl+F.
NOTE
l Cyclic find all is supported.
l The tool does not support inter-file search and wildcard search.
l You can enter a maximum of 128 characters in the Find What text box
of the Find dialog box.
Replace Replace character strings. You can choose either of the following
two methods:
l Right-click the script editing area, and then choose Replace.
l Press Ctrl+R.
NOTE
l Cyclic replace all is supported.
l The tool does not support inter-file replace and wildcard find and
replace.
l You can enter a maximum of 128 characters in the Find What text box
of the Replace dialog box.
Redo Redo the undo operation in one of the following two ways:
l Right-click the script editing area, and then choose Redo.
l Press Ctrl+Y.
NOTE
The number of redo operations is equal to that of undo operations.
Operation Procedure
Go to Line Enter a line number to position the cursor at the specified line. You
can choose either of the following two methods:
l Right-click the gray area on the left part of the script editing
area, and then choose Go to Line.
l Press Ctrl+G.
NOTE
The number that you can enter is from 1 to 99999.
Add/Remove Bookmark You can use a bookmark to implement the skipping inside a file;
thus facilitating your positioning of the script file. You can choose
either of the following two methods:
l Right-click the gray area on the left part of the script editing
area, and then choose Add/Remove Bookmark.
l Press Ctrl+F2.
NOTE
l If the current line is not marked, a bookmark is added.
To Next Bookmark Right-click the gray area on the left part of the script editing area,
and then choose To Next Bookmark. Alternatively, press Shift
+F2.
To Previous Bookmark Right-click the gray area on the left part of the script editing area,
and then choose To Previous Bookmark. Alternatively, press Alt
+F2.
Remove All Bookmarks Right-click the gray area on the left part of the script editing area,
and then choose Remove All Bookmark.
Step 4 Click . Alternatively, right-click the tab bar of the script editing area, and then choose
Save.
NOTE
l If it is the first save, the Save As is displayed. Specify the path and file name and click Save.
l To save a script file in other name or to other path, click . Alternatively, right-click the tab bar
of the script editing area, and then choose Save As.
----End
Prerequisite
l You are authorized to operate scripts.
l A script file is already compiled.
l There is no debugging task.
Context
When you start to debug a script, the system creates a debugging task for the script.
CAUTION
If a debugging task already exists, you cannot create a new debugging task. Only after the existing
debugging task is deleted, a new debugging task can be created.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
Step 2 Click . Alternatively, right-click the tab bar in the edit area, and then choose Open.
Step 3 In the Open dialog box, select the script file to be debugged, and then click Open.
Step 4 Click . Alternatively, right-click the script editing area, and then choose Debug.
NOTE
You can right-click the script editing area and choose Check to check grammatical errors in the script and
to debug after grammatical errors are removed.
Step 5 In the iSStar Debug Window, you can perform the following operations as required.
If... Then...
If... Then...
If... Then...
You want to add/remove breakpoints, You can choose any of the following methods:
l Click .
l Press F9.
l Right-click the left gray area of the iSStar
Debug Window window or iSStar Main
Window window, and then choose Add/
Remove Breakpoint. For details about the
iSStar Debug Window, refer to 1.5.1 Script
File Development. For details about the
iSStar Main Window, refer to 1.5.1 Script
File Development.
NOTE
You can set a maximum of 32 breakpoints for one file.
The breakpoints are not saved after the file is closed.
You want to clear all breakpoints, You can choose any of the following methods:
If... Then...
You plan to activate the editing window, Click . The iSStar Main Window window
is displayed. You can edit the currently-
debugging script file.
NOTE
A debugging script is modified in the iSStar Main
Window. The modified script takes effect upon the
next debugging.
You plan to activate task management Click . The iSStar Task Manage
window, Window window is displayed. You can view the
script task of the corresponding script.
----End
Result
During the debugging, the debugging information is displayed on the Message tab page, the
MML Response tab page, the Stack tab page, and the Watch tab page of iSStar Debug
Window.
l The Message tab page displays the system information during the debugging of the script
files. The system information includes script debugging output information, script running
output information, error information, and syntax check results.
l The MML Response tab page contains the MML commands and displayed information
during the running and debugging of the script file.
l The Stack tab page displays the complete path information invoked by the current function.
The path is refreshed as the script file is being executed.
l The Watch tab page displays the change information of the variables during the debugging
of the script file.
Postrequisite
Click during the debugging. The iSStar Main Window window is displayed. You can edit
the currently debugging script file.
Procedure
Step 1 Choose Maintenance > iSStar > Development. The iSStar Main Window is displayed.
Step 2 Right-click the project management area of iSStar Main Window, and then choose Create
Step 3 Set parameters on the Basic Parameter tab page and the Preset Parameter tab page of the
Create Project dialog box.
The basic information to be set is as follows:
l Project name: indicates the name of the project. This parameter is mandatory.
l Project path: indicates the save path of the project file.
l Main file: indicates the entry file of the project. You can set this parameter after creating a
project and adding script files.
l Project description: indicates the brief description of the project.
l If the Running on background: is Yes, you can infer that a project is running on background.
The results are not displayed on the foreground. If the Running on background: is
Noindicates that a project is running on foreground. The results are displayed on the
foreground.
l Created by: indicates the creator of the script project.
l Creation time: indicates the creation time of the script project.
l File list: displays the main file information about the project when main file is set.
Step 5 In the navigation tree of the project management area, you can perform the following operation
to create a script project.
Set the main file of the script project, In the navigation tree of the project management
area, right-click the script file name node which you
plan to set as main file, and then choose Set Main
File.
Remove a script file from the script In the navigation tree of the project management
project, area, right-click the script file name node which you
want to set as main file, and then choose Remove
File from Project.
NOTE
To remove a file from the project is to remove a script file
from the script project rather than to remove the script file
itself.
----End
Prerequisite
l You are authorized to operate scripts.
l A script project file is already compiled.
l There is no debugging task.
Context
When you plan to debug a script project, the system creates a debugging task for the script
project.
CAUTION
If a debugging task already exists, you cannot create a new debugging task. Only after the existing
debugging task is deleted, a new debugging task can be created.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
Step 2 Click . Alternatively, right-click the project management area, and then choose Open
Project.
Step 3 In the Open dialog box, set Project File(*.dsl) as File Type. Select the script project file or
project package file to be opened, and then click Open.
Step 4 In the navigation tree of the project management area, right-click the project name node, and
then choose Debug Project from the shortcut menu. Alternatively, click .
----End
Result
During the debugging, the debugging information is displayed on the Message tab page, the
MML Response tab page, the Stack tab page, and the Watch tab page of iSStar Debug
Window.
l The Message tab page displays the system information during the debugging of the script
files. The system information includes script debugging output information, script running
output information, error information, and syntax check results.
l The MML Response tab page contains the MML commands and displayed information
during the running and debugging of the script file.
l The Stack tab page displays the complete path information invoked by the current function.
The path is refreshed as the script file is being executed.
l The Watch tab page displays the change information of the variables during the debugging
of the script file.
Postrequisite
Click during the debugging. The iSStar Main Window window is displayed. You can edit
the currently debugging script file.
Prerequisite
l The connection between the M2000 and the server is normal.
l The script project files are ready.
Context
l The script project files of the local script applications are saved and executed on the local
PC. The script project files of the remote script applications are saved and executed on the
server. Remote applications can be shared among different clients.
l You can organize different script applications into different workspaces as required.
l You can create a maximum of 10 workspaces.
l In each workspace, you can create a maximum of 70 bookmarks.
l The extension of a script application file is .hsp.
CAUTION
You need to set up local script applications for the programs concerning GUI interaction. If you
create a remote script application, the interaction interface is not displayed on the client so that
the operation of the script application fails.
Procedure
Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application
Management window is displayed.
Yes
1. Click . The Workspace window is displayed.
2. Enter a value in the Workspace Name, and then
click OK.
Step 3 Click . Alternatively, right-click the blank area of Workspace, and then choose Add
Bookmark. The Add Bookmark window is displayed.
Select the Application Type. Enter the Bookmark Name. Then, click , and then select
Icon File.
Local application
1. Click of the Source File. The Open window is displayed.
2. Select a project file, and then click Open.
Remote application
1. Click of the Source File.
2. In the Remote File Summary window, select a project file, and then
click OK.
----End
l Based on the execution time, tasks can be classified into immediate tasks and scheduled
tasks.
– An immediate task refers to a task that requires running immediately after it is started.
– A scheduled task refers to a task executed based on the specified start time, running
period, and run times after it is started.
l Based on the location where task are executed, tasks are classified into local tasks and
remote tasks.
– Local tasks refer to the tasks whose files are saved and operated on the local computer.
– Remote tasks are the tasks whose files are saved and operated on the server. Through
iSStar Task Manage Window, each client user can view the running state and results
of the remote tasks created on its client.
NOTE
Suspended Indicates that the tasks are not scheduled by the system. After an
immediate task is created or copied, it is in the suspended state.
Finished The task has finished running. After a script file finishes running,
it is in the finished state.
Terminated exceptionally If exceptions occur or the task is stopped during the running, the
state of the task is terminated exceptionally.
Pausing The system is pausing the task. The task is transiting from the
running state to the paused state.
A debugging task has the following states: suspended, debugging, debug finished, and
terminated exceptionally. Figure 3-4 shows the states. Table 3-2 describes Figure 3-3.
Debug finished Indicates that the script execution is complete and the debugging
ends. After a script file finishes debugging, it is in the debug
finished state.
Terminated exceptionally If exceptions occur or the task is stopped during the debugging,
the state of the task is terminated exceptionally.
Running After being dispatched, an idle task changes to the running state.
If a running task is canceled, its state changes to idle.
Suspended You can suspend an idle scheduled task. Then, the task is in the suspended
state.
The suspended task changes to the idle state if you resume it.
Prerequisite
l You are authorized to operate scripts.
l A script file is already compiled.
Context
l To run a script file is a procedure that the iSStar descriptor parses and executes the content
of the script file to provide specific service functions.
l Each time you run a script file, the system creates a corresponding script task.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
Step 2 Click . Alternatively, right-click the tab bar in the edit area, and then choose Open.
Step 3 In the Open dialog box, select the script file to be executed, and then click Open.
Step 4 Click . Alternatively, right-click in the edit area, and then choose Run.
NOTE
l You can run the script of an iSStar script file without opening it. To run a script without opening a
script file, you can click , select Select Task and Run, and in the displayed Open dialog box select
a script file.
l You can run the specified continuous script of the opened script file. To do so, open the script file to
be executed and select the continuous scripts to be executed. Then, click , and then select Range
Execution.
Step 5 In the iSStar Execute Window, you can perform the following operations as required.
appears dimmed.
appears dimmed.
View the output directory, Click , you can locate the directory of the system's
output files.
NOTE
After a script finishes running, you can view the output
Activate the editing window, Click . The iSStar Main Window window is
displayed.
Activate task management window, Click . The iSStar Task Manage Window
window is displayed. You can view the script task of
the corresponding script.
----End
Prerequisite
l You are authorized to operate scripts.
l A script project is already compiled.
Context
l A main file is the entrance file for the running of a script project. The running of a script
project begins from the main file. The running of all scripts follow the preset logical
sequence.
l The system creates a task for each running script project.
l If a script project is set to background running, during running of the project, you do not
access iSStar Execute Window. Otherwise, you access iSStar Execute Window. For
operations in the window, see 3.3.2 Running a Script File.
Procedure
l To run a script project, perform the following operations.
1. Choose Maintenance > iSStar > Development Platform. The iSStar Main
Window is displayed.
2. Click . Alternatively, right-click the project management area, and then choose
Open Project.
3. In the Open dialog box, select the script project file or project package file to be
opened, and then click Open.
The file of which the File Type is *.dsl is a script project file. *.hsp is a script project
package file.
CAUTION
If the script project package does not support the decompression operation, the system
displays Decompressing the project package is not supported.
Click . Choose Select Task and Run to run the script project package that cannot
be decompressed.
4. In the navigation tree of the project management area, right-click the node of project
name, and then choose Run Project from the shortcut menu. Alternatively, click
.
l To run a script file of the already opened project, perform one of the following operations:
– In the navigation tree of the project management area, right-click the script file name
node of the project, and then choose Run Single File.
– In the navigation tree of the project management area, double-click the script file name
node of the project to be executed, or right-click the node, and then choose Open. Then,
click .
----End
Prerequisite
l The connection between the M2000 and the server is normal.
l A script application is already created.
Procedure
Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application
Management window is displayed.
Step 2 Click the workstation where the script file to be executed is located.
Step 3 Perform different operations according to whether the application requires to select the NEs.
No Go to Step 4.
Yes
1. Click or . The Please select an operation NE dialog
box is displayed.
NOTE
Execute immediately You can use one of the following methods to run an application:
l Click .
l Double-click the script application bookmark.
l Right-click the script application bookmark and choose Run.
Scheduled execution 1. Right-click the application bookmark and select Timer Task. The
New Task dialog box is displayed.
2. Set the basic information about the task. The basic information to
be set is as follows:
l Task Name: indicates the name of a scheduled task.
l Task Type: Set it to Script Executor.
l Run Type: Set it to Once or Period.
3. Click Next to set the time for the execution of a task.
4. Click . In the displayed Date/Time Selection dialog box, set the
start time.
5. If the execution type is once, click Next. Otherwise, enter values in
Period and Run Times, and then click Next.
6. Set the Accessory File and NEs to be operated as required.
7. Click Finish.
----End
Postrequisite
The iSStar creates a script task for the running script application. In case of immediate tasks,
you can view the states of the script tasks and terminate the script tasks in iSStar Task Manage
Window. For details, see Viewing the Script Task States and Stopping a Script Task. In case
of scheduled tasks, you can manage the tasks in Task Management.
Prerequisite
The script is running.
Procedure
Step 1 After the script is executed, the system automatically goes into the iSStar Execute Window.
For running a script file, see 3.3.2 Running a Script File.
Step 2 View the output information between different interfaces of the system
Area Description
Print output area Displays the output information of the print function during
the execution of a script
Area Description
MML message output area Displays the MML command and return information during
the execution of a script.
MML command statistic bar Displays the number of commands sent, the number of
commands successfully executed, and the number of failed
commands.
Step 3 Views the output information. You can execute the following operations on the output
information as required.
Operation Procedure
Copy 1. Copies the text you need in the print output area or MML message output area.
2. Right-click the text you select, and then choose Copy. Alternatively, you can
use the shortcut keys Ctrl+C.
Clear Right-click the print output area or MML message output area and select
Clear.
Find Right-click the print output area or MML message output area, and then choose
Find. Alternatively, you can the shortcut keys Ctrl+F.
NOTE
l Cyclic find all is supported.
l You can enter up to 128 characters in the Find What text box of the Find dialog box.
Save as 1. Right-click the print output area or MML message output area and select Save
as.
2. Set the path and file name of storage in the Save As dialog box. Click Save.
Re-direct 1. Right-click the print output area or MML message output area and select
Redirect To.
2. Set the path and file name of storage in the Save As dialog box. Click Save.
----End
Prerequisite
A running or debugging task exists.
Context
Running tasks and debugging tasks have different states. Eight task states are available. For
details, see Types and States of Script Tasks.
l A running task has the following states: suspended, running, finished, pausing, paused, and
exceptionally terminated.
l A debugging task has the following states: suspended, debugging, debug finished, and
exceptionally terminated.
NOTE
Because only one existing debugging task is allowed on the M2000 client, the debugging and debug
finished cannot co-exist.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
Step 2 Perform operations according to the task types.
Immediate tasks
1. Click . The iSStar Task Manage Window is displayed.
2. Go to Step 3.
Scheduled tasks Click to start the Task Management window. You can view the task
information of the task list in the right window.
Step 3 In iSStar Task Manage Window, select the Local Task or Remote Task tab according to the
task type to be created.
View the task state, including main file of the task, task type, selected NE, task state, progress,
start time, and end time.
NOTE
l The Progress is described in scripts and fed back to the client. When the statement feeding back the
progress is operated, the Progress exports the progress value in the scripts. If there is no statement
feeding back the progress in the scripts, Progress is always displayed as 0%.
----End
Prerequisite
A script task is already created.
Procedure
l To view the output information of the print, perform the following steps:
1. Choose Maintenance > iSStar > Development Platform. The iSStar Main
Window is displayed.
The system generates a folder for the log file generated each time and saves the folder to the
specified path. The result log file is named in the format YYYY-MM-DD_HH-MM-SS, for
example, 2008-04-18_10-27-53.
----End
Result
For tasks that are running in the foreground, the system displays iSStar Execute Window. For
tasks that are running in the background, the system opens the task output file.
NOTE
For tasks that are running in the background, if the script file does not invoke the print function nor the
MML commands, the task does not display files. If you want to view the task output file, the system displays
a dialog box, prompting you that the file does not exist.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
Step 3 In the iSStar Task Manage Window, click the Local Task or Remote Task tab based on the
target task type.
NOTE
The files of local tasks are saved and executed on the local PC. The files of remote tasks are saved and
executed on the server.
Step 4 Right-click a script task to be operated, and then choose Pause or Resume.
After you pause a running script task, the script task transfers its state from the pausing state to
the paused state. After you resume a paused task, the task transfers its state from the pausing
state to the running state. For details, see States of an Immediate Task.
----End
Prerequisite
A script task is in the running state.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
Step 3 In the iSStar Task Manage Window, click the Local Task or Remote Task tab based on the
target task type.
NOTE
The files of local tasks are saved and executed on the local PC. The files of remote tasks are saved and
executed on the server.
Step 4 Right-click the target task, and then choose Stop from the shortcut menu.
After this operation, the system stops the running or debugging task. The task state changes
toTerminated Exceptionally.
----End
Result
After a task is stopped, you cannot restart or resume the task.
Prerequisite
If you need to delete a remote task, ensure that the connection between the client and the M2000
is normal.
Context
l You can delete the local script task that you create on the client and the remote script task
that you create.
l Deleting a script task does not involve the deletion of the script of the script task and of the
script project.
l You can delete a task in any state.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform. The iSStar Main Window is
displayed.
The files of local tasks are saved and executed on the local PC. The files of remote tasks are saved and
executed on the server.
Step 4 Right-click a script task to be deleted, and then choose Remove from the shortcut menu.
The system deletes the script task and the corresponding information displayed in the iSStar
Task Manage Window.
NOTE
If the script task is running, the Delete the task dialog box is displayed. Click Yes. The script task is
terminated exceptionally.
----End
This describes how to view the information about local script applications and remote script
applications. The information about script applications includes script application types and
preset parameters.
3.4.2 Downloading a Script Application to the Local Terminal
This describes how to download the remote script applications that are shared on the server to
the local terminal.
3.4.3 Issuing a Script Application to the Server
This describes how to issue local script applications to the server so that the applications can be
shared. The release operation involves uploading the script application to the server and
registering it on the server.
3.4.4 Deleting a Script Application
This describes how to delete script applications. The script applications are categorized into local
script applications and remote script applications.
3.4.5 Managing Script Application Bookmarks
A bookmark is related to a specific script application and is the entry to script applications. A
script application is displayed on an interface as a bookmark. You can create, modify, or delete
bookmarks.
Prerequisite
l If you need to view local script applications, ensure that the bookmark of the script
application is created on the client.
l If you need to check remote script applications, ensure that the connection between the
client and the M2000 server is normal.
Procedure
l To view the information about the local script application, perform the following steps:
1. Choose Maintenance > iSStar > Application Management. The iSStar
Application Management window is displayed.
2. Click the target workstation to use the existing workstation.
3. Right-click the bookmark of a local script application, and then choose Bookmark
Properties. The Bookmark Properties window is displayed.
You can view or modify the bookmark properties.
4. Click OK to save the modification and close the window.
l To view the information about the remote script application, perform the following steps:
1. Choose Maintenance > iSStar > Application Management. The iSStar
Application Management window is displayed.
2. You can perform the following operations according to the existence of the
corresponding bookmark of the script application.
If... Then...
The corresponding shortcuts exist. 1. Click the target workstation to use the
existing workstation.
2. Right-click the bookmark of a remote
script application, and then choose
Bookmark Properties. The
Bookmark Properties window is
displayed.
You can view or modify the
bookmark properties.
3. Click OK to save the modification
and close the window.
----End
Prerequisite
l The connection between the M2000 and the server is normal.
l The corresponding applications exist on the server.
Procedure
Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application
Management window is displayed.
Step 3 You can perform the following operations based on whether the iSStar Application
Management window has the bookmark of the corresponding script application.
If... Then...
The bookmark corresponding to the remote 1. Right-click the bookmark of the remote
script application exists, script application, and then choose
Download File from the shortcut menu.
Alternatively, right-click the bookmark of
the remote script application. Then, click
----End
Prerequisite
l The connection between the M2000 and the server is normal.
l Script applications already exist.
Procedure
Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application
Management window is displayed.
Step 2 Click . Alternatively, right-click the blank area of the workspace, and then choose Issue
File from the shortcut menu. The Open window is displayed.
NOTE
You can also right-click the bookmark of the local script application, and then choose Issue File from the
shortcut menu. Then, the script application of the bookmark is issued to the server.
You can click to check whether the file is uploaded to the server in Remote File
Summary.
----End
Prerequisite
If you need to delete a remote application, ensure that the connection between the client and the
M2000 is normal.
Context
l The local script applications are saved and executed on the local PC.
l The remote script applications are saved and executed on the server.
l You can delete the script applications on the server issued by yourself or by other users.
l The corresponding bookmarks are still available after the local or remote applications are
deleted.
CAUTION
If a script application on the server is deleted, all the bookmarks created on the basis of this script
application by users on the clients are unavailable.
Procedure
Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application
Management window is displayed.
Step 2 You can delete a remote script application by using the remote file management function or
using the remote application bookmark.
NOTE
The local script applications are saved on the clients. To delete a local script application, you need to delete
only the folder saving this application.
----End
Context
Deleting a bookmark does not involve the deletion of the script application of the bookmark but
only the deletion of the icon of the bookmark on the script application platform.
Procedure
Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application
Management window is displayed.
Step 2 You can create, modify, or delete bookmarks.
l For details about how to create a bookmark, refer to 3.2.5 Creating a Script Application.
l Modify the properties of a bookmark.
After you click a bookmark, click . Alternatively, right-click a bookmark, and then choose
Bookmark Properties. You can modify the properties of a bookmark in the Bookmark
Properties window.
l Delete a bookmark.
Right-click a bookmark, and then choose Delete Bookmark. In the displayed Confirm
prompt box, click Yes.
----End
4 HSL Reference
The High Level Script Language (HSL) is a simple but powerful script language provided by
the iSStar. HSL reference contains the HSL syntax, data types and methods supported by HSL.
4.1 HSL Syntax
The syntax of HSL contains identifiers, keywords, statements, operators, and so on. To use the
HSL to write scripts better, you must understand the HSL syntax.
4.2 Data Types and Methods in the HSL
This section describes basic data types and their methods in the HSL. It helps you to use the
HSL for development. The data types supported by the HSL are as follows: numeric, string, list,
tuple, dictionary, and file.
4.3 HSL Built-In Function
This section describes the HSL built-in function that provides a group of object-specific
operation functions.
4.1.1 Identifier
An identifier is a string. It is a name that is used to identify a variable or a function in a program.
4.1.2 Keywords
A keyword is also called a reserved word. It is an identifier pre-defined in HSL.
4.1.3 Statements
As basic units of script programs, statements can be classified into simple statements, MML
statements, and compound statements.
4.1.4 Operator
Operators are divided into basic operators, bit operators, comparative operators, Boolean
operators, sequence operators, and dictionary operators.
4.1.5 String Format
This section describes the string formats in HSL. You can view the information and perform
operations.
4.1.6 Comment
A comment gives the information on a program. It is not processed by the interpreter. HSL
supports line comment and block comment in a script.
4.1.7 Condition
A condition is used to express the process for selecting the program branches.
4.1.8 Loop
A loop statement is used to express the repeated process for a program. The HSL supports two
types of loop statements: for statement and while statement.
4.1.9 Function
A function is the basic multiplex unit provided by the language.
4.1.1 Identifier
An identifier is a string. It is a name that is used to identify a variable or a function in a program.
4.1.2 Keywords
A keyword is also called a reserved word. It is an identifier pre-defined in HSL.
CAUTION
l The keywords in HSL are unique in the script.
l Keywords cannot be re-defined.
Table 4-1 lists the keywords used in HSL. The keywords global, assert, pass, try, except, raise,
finally, exec, class, lambda, import, del, print, from, is, and yield are reserved keywords. They
are used for the future syntax expansion.
4.1.3 Statements
As basic units of script programs, statements can be classified into simple statements, MML
statements, and compound statements.
Simple Statement
l Generally, a statement line corresponds to a text line. A line feed character (\n) is the end
mark.
l If a statement is presented in multiple text lines, an extended line (\) must be used at the
end of each text line.
l A text line can include multiple simple statements which are separated by semicolons (;).
NOTE
l An extended line character is not permitted to use at the end of files. Otherwise, semantic errors may
occur.
l An extended line character is invalid to a comment line.
MML Statement
An MML statement ends with a semicolon (;), with parameters separated by commas (,) and
parameter expressions separated by equal marks (=).
The MML statement has two types: line mode and block mode. Table 4-2 describes the two
types of MML statements.
CAUTION
l Do not write MML command statements and simple statements in the same text line.
l You can use MML statements to issue MML commands to only the NE that supports MML
command.
l Issuing MML commands to the NE that is being upgraded might fail.
l If you need to issue more than 500 MML commands, it is recommended that you use the
block mode, and ensure that every 500 MML commands are packed in a block, and you
invoke the ClearMMLBuffer function to clear the buffer of MML messages at the end of
each block.
MML Format
Statement
Compound Statement
The compound statement has three types:
l Conditional statement: if...elif...else...end. The format is as follows:
if expr
stmt
[elif expr
stmt]
[else
stmt]
end
l Loop statement: for...in...end. The format is as follows:
for atom in list
stmt
end
l Loop statement: while...end. The format is as follows:
while expr
stmt
end
4.1.4 Operator
Operators are divided into basic operators, bit operators, comparative operators, Boolean
operators, sequence operators, and dictionary operators.
For details of the operators, see Table 4-3.
x-y Subtract
x*y Multiply
x/y Divide
-x Unary negation
+x x
x ** y x to the power of y
x|y Bitwise or
~x Bitwise exclusive
x == y Equal
x != y Not equal
Method Description
For index smaller than -4 or higher precision, use %e or %E. Otherwise, use
g,G
%f.
c Single character
4.1.6 Comment
A comment gives the information on a program. It is not processed by the interpreter. HSL
supports line comment and block comment in a script.
l The line comment starts with #, and it is used to comment the content contained in a line.
l The block comment uses """ or ''', and it is used to comment multiple lines of texts.
CAUTION
Block comment can be used together with statements. A semicolon, however, is required to
separate the block comment from the statements.
4.1.7 Condition
A condition is used to express the process for selecting the program branches.
The script language supports the if...elif...else...end statement. The writing format is as follows:
if expr
if_stmt…
[elif expr
else_stmt…]…
[else
else_stmt…]
end
Example
x = 100
if x > 0
Print("x is positive")
elif x == 0
Print("x is zero")
elif x < 0
Print("x is negative")
else
Print("x is not a integer")
end
x = 0
if x > 0
Print("x is positive")
elif x == 0
Print("x is zero")
elif x < 0
Print("x is negative")
else
Print("x is not a integer")
end
x = -100
if x > 0
Print("x is positive")
elif x == 0
Print("x is zero")
elif x < 0
Print("x is negative")
else
Print("x is not a integer")
end
4.1.8 Loop
A loop statement is used to express the repeated process for a program. The HSL supports two
types of loop statements: for statement and while statement.
For loop
The format of a for loop statement is as follows:
for atom in list
stmt(for)...
end
Example
for num in [1,2,3,4]
Print('I can count to ' + str(num) )
end
Result
I can count to 1
I can count to 2
I can count to 3
I can count to 4
While loop
The format of a while loop statement is as follows:
while expr
stmt(while)...
end
Example
x = 1
while(x < 5)
Print(x)
x = x + 1
end
Result
1 2 3 4
Cross Nesting
The HSL loop has an else clause, and the program codes after this clause are executed after the
loop is finished. For a for loop, the completion of the programming refers to the completion of
the list statements. For a while loop, the programming is complete when the condition changes
to false. If a loop is terminated exceptionally, for example, break, the else clause is not executed.
Example
for n in range(2,10)
for x in range(2,n)
if n%x == 0
Print(str(n) + ' equeals' + str(x) + ' *' + str(n/x))
break
end
else
Print(str(n) + ' is a prime number')
end
end
Result
2 is a prime number
3 is a prime number
4 equeals2 *
5 is a prime number
6 equeals2 *3
7 is a prime number
8 equeals2 *4
9 equeals3 *3
Result
I can count to 1
I can count to 2
Result
I can count to 1
I can count to 2
I can count to 4
NOTE
In a loop, an iteration range should be specified for a number. Two methods are provided in HSL, that is, while
loop and value list of the range function (list also applies).
l Example: Using the while loop
x = 1
while(x < 5)
Print(x)
x = x + 1
end
l Example: Using the range function to get value list
for x in range(1,10)
Print(str(x))
end
4.1.9 Function
A function is the basic multiplex unit provided by the language.
NOTE
l The HSL does not support function re-loading. A newly-defined function automatically overwrites
the previous function with the duplicate name.
l The function definitions do not need to designate a return value. If you do not designate a return
value, a default object None is returned after the function is invoked.
l The recursive invoking of a function has a maximum depth at 1,000.
l The function definitions can be nested.
Example
def showHello()
Print("Hello!")
end
showHello()
This section describes a file which provides basic operations for files, such as, opening, reading,
and writing files.
4.2.1 Number
This section describes the numeric types of the HSL and details of numeric operations.
Types
Table 4-6 lists numeric types and value example.
Integer 1234,-24,0
Floating 2.11,2.43e-10,5E12,6.0e+21
Complex 3+4j,3.0+4.0j,4j
Operation
Table 4-7 lists details of numeric operations.
x or y Logical OR
x|y Bitwise or
x + y, x - y Plus, subtract
x ** y x to the power of y
Example
#Get the result of x**y.
x = 2
y = 3
Print(x**y)
Result
8
4.2.2 Sequence
The sequence objects are accessed by digital index. The sequence contains the following types:
string, Unicode string, list, and tuple.
Overview of Sequence
Sequence includes the following types: string, Unicode string, list, and tuple. All types of
sequence contain common operations.
NOTE
l Unicode standard is designed to serve as the collection of standards for interchanging text information
globally. As Unicode standard includes the information related to character set and multi-byte format
of the interchanged data, it can ensure that the read information is in the correct format and language.
l All the strings in HSL do not use Unicode format automatically. HSL supports a new data type, that
is, Unicode string. You can create a new Unicode object by adding a prefix u to the string, which is
the same as the method of using the original string.
Common Operations
Operation Description
Index that is used for only lists and tuples. See Example 1:
seq[i][j]
Calculation in slices.
Slice. Select the elements from i to j in the indexes of seq. The step
length is s.
seq[i:j:s] The default values for i, j, and s is 0, len(seq), and 1 in sequence.
If j is less than i, return a null string. If j is more than len(seq),
replace j with len(seq).
Get the length of seq. See Example 3: Using len() to Get the
len(seq)
Lengths of str, list, and tuple.
Result
s[3] = 3
s[-1] = 9
s[2:6] = 2345
s[2:8:2] = 246
word !0123456789
word !word !word !
#Determine whether 'f' is contained in str. If yes, return True. If no, return False.
Print('f' in str)
#Determine whether 'f' is contained in str. If no, return True. If yes, return False.
Print('f' not in str)
Result
False
True
Example 3: Using len() to Get the Lengths of str, list, and tuple
#Get the length of str.
str1 = 'Hello word'
Print('Length of str1: ' + str(len(str1)) )
Result
Length of str1: 10
Length of list1: 3
Length of tuple1: 2
Example 4: Using min() to Get the Minimum Item in str1, list1, or tuple1
#Get the minimum item in str1.
str1 = 'asdff'
Print(min(str1))
Result
a
3
4
Example 5: Using max() to Get the Maximum Item in str1, list1, or tuple1
#Get the maximum item in str1.
str1 = 'asdff'
Print(max(str1))
Results
s
9
10
String
A string consists of single or double quotation marks. For example, 'hello' and "world" are of
the string type.
Returns a string whose initial part and end part are filled with
fillchar. The middle part is the same as the original string .
The width argument is an integer and indicates the length of
the return string. The fillchar argument is a string and
indicates the characters to be filled in the initial and end parts
of the return string.
s.center(width[,fillchar]) NOTE
l When the length of width is not greater than that of the original
string, s is returned and no padding is done.
l When the length of width is greater than that of the original string,
fill in fillchar in turn according to the order of filling in the tail
first and then filling in the head. The padding number is the
difference of the length of width and the original string.
Method Description
If all the characters in the string are digits and at least one
character exists in the string, True is returned. If any
s.isdigit()
character in the string is not a digit or no character exists in
the string, False is returned.
Method Description
If all the letters in the string are lowercase and at least one
letter exists in the string, True is returned. If any letter in the
s.islower()
string is not lowercase or no letter exists in the string, False
is returned.
If all the characters in the string are blank spaces and at least
a character exists in the string, True is returned. If any
s.isspace()
character in the string is not a blank space or no letter exists
in the string, False is returned.
Method Description
Uses sep as the delimiter string, and then splits a string into
multiple substrings. Arranges the substrings in a list, and then
returns the list. If maxsplit is specified, the string can be split
for a maximum of maxsplit times from the right to the left. If
s.rsplit([sep [,maxsplit]])
you maintain the default value of maxsplit, then the string can
be split for unlimited times. If sep is not specified, use a space
as the delimiter string. The sep argument is a string, and the
maxsplit argument is an integer.
Removes the character at the end of the string and returns the
s[:(n+1)] string. The letter n refers to the serial number of the
first character that is not in chars. The first character is
s.rstrip([char])
counted from the right of the string. The char argument is a
string. If you do not set char or char to None, remove the
blank character at the right side of the string by default.
Returns a list of the words in the string and uses sep as the
delimiter string. If maxsplit is given, at most maxsplit splits
are done. (Thus, the list will have at most maxsplit +1
elements). If maxsplit is not specified or is zero, then there is
no limit on the number of splits (all possible splits are made).
Consecutive delimiters are not grouped together and are
s.split([sep [,maxsplit]]) deemed to delimit empty strings.
For example,
l " '1,,2'.split(',') "p_returns " ['1', '', '2'] ").
l " '1, 2, 3'.split(', ') " returns " ['1', '2', '3'] ").
l "''.split(',') " returns "[] ").
Method Description
Removes the start and end characters of the string, and then
returns the s[m:(n+1)] string. The letter m refers to the serial
number of the first character that is not in chars. The first
character related to m is counted from left of the string. The
s.strip([char]) letter n refers to the number of the first character that is not
in chars. The first character related to n is counted from right
of the string. If you do not set the value of char or char to
None, right and left blank characters in the string are removed
by default.
Returns title characters, that is, the initial letter of the copy
string and all the letters immediately following characters
s.title()
other than letters should be changed to uppercase letters.
Letters in other positions are changed to lowercase letters.
Special Character
Special characters and their descriptions are listed in Table 4-9.
Name Description
\\ Backslash
Name Description
\a Bell
\b Space character
\e Escape
\0 Null
\OOO octal(000-377)
\xhh hex(x00-xff)
Formatted String
The basic usage is s%<tuple>. The tuple indicates a parameter list, and it is similar to printf in
the C language. Indicate each value in the tuple using the string. The representation format is
determined by s. For example, Print("%s's height is %dcm"%("p_charles", 180)).
%s and %d are similar to printf in the C language. In the iSStar system, they are called escape
characters.
Character Description
u Unsigned integer
Character Description
List
List is another form of sequence objects. The list inherits many operation functions of strings.
Compared with the string, the list can include any objects.
Method Description
Adds elements in the L1 list at the end of the L list. It can also be
L.extend(L1)
written as L[len(L):]. = L1, where L1 is a list.
Returns the index value of the item whose first value is equal to x. If
L.index(x)
x is not contained in L, then the execution of scripts may have errors.
Tuple
Tuple is a constant list. This section describes the tuple and provides some examples. You can
refer to this section to perform relevant operations.
l Tuple is a constant list. Tuple has no such methods as pop, remove, and insert.
l Tuple is displayed by (), for example, a=(0,1,2,3). The round brackets can be omitted.
l Tuple can return elements or sub-tuples by using subscripts.
l Tuple can be used to assign values for multiple variables.
Example
t=(1,2)
a,b = t
Print("%d"%a)
Print("%d"%b)
Result
1
2
4.2.3 Dictionary
A dictionary has a random storage structure. Each element in the dictionary is called a pair. A
pair contains two parts: key and value. Key can be an integer or a string, and value can be the
data of random types. You can get value by D[key]. Duplicate keys are not available in the
dictionary.
Operations
For details of operations on dictionary objects, see Table 4-12.
Operation Description
dic2["key"] Index.
dic3["key1"]["key2"] Index.
Checks whether the key is the key value of the dic. If the key is
the key value of the dic, the result is True. If the key is not the
key in dic
key value of the dic, the result is False. (For details, see Example
2 in, not in.)
Checks whether the key is the key value of the dic. If the key is
not the key value of the dic, the result is True. If the key is the
key not in dic
key value of the dic, the result is False. (For details, see Example
2 in, not in.)
Gets the length of dic. (For details, see Example 3 Get the length
len(dic)
of the dic by the function len()..)
Result
{'sun': 1, 'moon': 2}
{'food': {'egg': 2, 'ham': 1}}
----------------------------
dic1['moon'] = 2
dic2['food']['ham'] = 1
----------------------------
dic1 = {'sun': 42, 'moon': 2}
#Determine whether "moon" is a key in dic. If yes, return True. If no, return False.
Print(("moon" in dic))
#Determine whether "moon"is a key in dic. If no, return True. If yes, return False.
Print(("moon" not in dic))
Result
True
False
Result
2
Method Description
Returns the first key value pair (key, value) in dic, and then
dic.popitem()
deletes the pair.
dic.iteritems() Returns the iterator of the key value pair (key, value) in dic.
4.2.4 File
This section describes a file which provides basic operations for files, such as, opening, reading,
and writing files.
close() Closes a file. A closed file cannot be read or written any more.
After the file is closed, any operations that need to read or
write the file stop the program. Calling close() more than
once is allowed.
flush() Clears the internal buffer. For some file objects, this function
may have no operation effect.
Mame Description
read([size]) Reads most size bytes from the file (less if the read hits EOF
before the size bytes are obtained). If the size argument is
negative or omitted, read all the data until EOF is reached.
The return value is a string. If the file is not empty, the read
file contents are returned. If the file is empty, a null string is
returned.
readline([size]) Reads the contents of a line. The content contains the line
feed character at the end of the line. If the file ends with an
incomplete line, no line feed character may exist. The return
value is a string. If the size argument exists and is not
negative, the maximum of the returned string is size,
including the line feed character. If the file starts with EOF,
a null string is returned.
NOTE
The returned string contains null characters ('\0') if they occurred in
the input information.
readlines() Reads the contents at the end of a file. EOF is the end mark
of a file. The return value is a list. The elements in the list are
of the string type. The content of each line is used as an item.
seek(offset[, whence]) Sets the current location for the file. No return value is
available. The value of the whence parameter can be one of
the following:
l 0: indicates the absolute location of the file.
l 1: indicates the relative location of the current location.
l 2: indicates the relative location of the end of the file.
The default value for whence is 0.
If a file is opened in an additional way, that is, 'a' or 'a+', then
cancel all the seek() operations when you write contents into
a file. If you open a file to only write contents into a file ('a'),
this method actually has no operation effect. When you open
a file to read contents ('a+'), you can still write contents into
a file. If a file is opened in text mode ('t'), you can use only
tell() to return the deviation value. Other values may incur
unknown results. Not all the file objects can use this function.
l If a specified size exceeds the current size of the file, the result
depends on the operating system. Possibilities include that the file
may remain unchanged, increase to the specified size as if zero-
filled, or increase to the specified size with undefined new
content.
Mame Description
closed Changes the state of a file object. The existing state of a file
object can be represented by objects of the bool type. This is
a read-only attribute and can be changed through close(). The
function is not applicable for all file objects.
Example
# Read the file by byte
def readBytes ( filePath )
# Open the file in read-only mode
f = Open( filePath, "r")
c=f.read(1)
buf = c
while c
#Print(c)
c = f.read(100)
buf = buf + c
end
f.close()
return buf
end
while line
#Print(c)
line = f.readline()
buf = buf + line
end
f.close()
return buf
end
filePath = "c:\\outfile.txt"
#Create a file
fp = Open(filePath, "w+")
fp.write("Hello World!\nNice to meet you.")
fp.close()
Result
The result of reading the file by byte:
Hello World!
Nice to meet you.
The result of reading the file by line:
Hello World!
Nice to meet you.
The result of reading multiple lines of the file:
Hello World!
coerce(x,y) Converts x and y into the same numeric type and returns as
a tuple.
complex(real [, imag]) Creates a complex number. The real part is real, and the
imaginary part is imag . If imag is not available, the
imaginary part is 0j.
max(s [, args, ...]) For a single parameter, returns the largest value in sequence
s. For several parameters, returns the parameter with the
largest value. For a sequence invoking several parameters,
parameters in each list are compared as a whole.
min(s [, args, ...]) For a single parameter, returns the smallest value in sequence
s. For several parameters, returns the parameter with the
smallest value. For a sequence invoking several parameters,
parameters in each list are compared as a whole.
Related Instances
list(s) Returns a list whose items and ordering of the items are
the same with that of the parameters.
repr(object) Returns the object in string type. The result is the same
with that using single counter quotation mark '. The
return string generates an object whose value is
consistent with that generated by transferring object to
eval().
tuple(s) Returns a tuple. The items and the sequence of the items
are the same with those of the parameters.
Related Instances
Function Description
Call(FileName) Runs the .hsl file with the name FileName. The running
results are as follows:
l FileName is a script file with no error. It indicates the
call function runs normally and the function returns
0.
l FileName is a script file but with errors. The call
function throws an exception.
l FileName does not exist. The call function returns
error code 4.
l FileName exists but is not a script file. The call
function returns error code 6.
l FileName is an Exit(errID) function. The errID is
returned if the script can be performed normally.
NOTE
For the files with no extension, process them as the script files.
Import(FileName) Imports the script module and supports nesting (that is,
importing from A to B, and B to C ). When the import
is running properly, the return value is a module object.
Otherwise, the return value is None.
Related Instances
Example
# common functions
n1 = abs(-1)
x = 10
y = 30
n2 = cmp(x,y)
n3 = complex( 10, 20 )
n4 = divmod(5,3)
l1 = [1,2,3,4,8,2,9,0]
n5 = max(l1)
n6 = min(l1)
Print("n1 = "+str(n1))
Print("n2 = "+str(n2))
Print("n3 = "+str(n3))
Print("n4 = "+str(n4))
Print("n5 = "+str(n5))
Print("n6 = "+str(n6))
Result
n1 = 1
n2 = -1
n3 = (10+20j)
n4 = (1, 2)
n5 = 9
n6 = 0
Example
Print("ord function returns the ASCII value of a string of one character or a Unicode character ")
t1 = ord('c')
Print(t1)
Print("p_chr function returns a string of one character whose ASCII code is the integer i")
t2 = chr(99)
Print(t2)
Print("coerce function returns a string of one character whose ASCII code is the integer i")
t3 = coerce(1,2)
Print(t3)
Print("oct function convert an integer number (of any size) to an octal string.")
t5 = oct(8)
Print(t5)
Print("hex function convert an integer number (of any size) to a hexadecimal string")
t6 = hex(15)
Print(t6)
Result
ord function returns the ASCII value of a string of one character or a Unicode
character
99
chr function returns a string of one character whose ASCII code is the integer i
c
coerce function returns a string of one character whose ASCII code is the integer
i
(1, 2)
long function convert a string or number to a long integer.
1
oct function convert an integer number (of any size) to an octal string.
010
hex function convert an integer number (of any size) to a hexadecimal string
0xf
Example
#Take the range function as an example. The synopsis is as follows: range([start,] stop [,step]).
#result: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Print(range(10))
#result: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Print( range(1, 11))
#result: [0, 5, 10, 15, 20, 25]
Print( range(0, 30, 5))
#result: [0, 3, 6, 9]
Print( range(0, 10, 3))
#result: [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
Print( range(0, -10, -1))
#result: []
Print(range(0))
#result: []
Print(range(1, 0))
Result
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[0, 5, 10, 15, 20, 25]
[0, 3, 6, 9]
[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
[]
[]
The iSStar provides various library functions, such as Time functions, Input and Output
functions, GetError Function, GetError Function, Directory Operation Function and so on. These
functions are called High level Foundation Classes (HFC) functions. HFC functions help you
to compile simple scripts and facilitate debugging and maintenance.
The iSStar uses the type conversion function to provide the exception protection mechanism for
data type conversion. This prevents the script execution from being terminated by a conversion
error.
5.8 Time Function
This section describes the time functions which enable you to obtain the information related to
time and provide the function for converting time formats.
5.9 Input and Output Function
This section describes input and output functions and the function of setting the output mode.
5.10 GetError Function
This functions provides the unified handling function for error codes. It enables you to obtain
the last error information list and the error cause function.
5.11 Network Operation Function
You can perform network communications operations through the network operation functions.
For example, you can upload and download files, log in the system remotely, and run commands
remotely.
5.12 Report Operation Function
This describes the report operation functions. By using these functions, you can perform the
related operations such as design, display, and manage reports.
5.13 Directory Operation Function
This section describes the operation functions related to the files and directories.
5.14 GUI Interactive Library Function
GUI interactive library functions enable you to interact with the GUI through the controls during
the execution of a task.
5.15 Task Management Function
The task management functions are the operation functions related to the task.
5.16 Assertion Function
Assertion functions are the operation functions related to assertion.
5.17 Mail Sending Function
The functions of setting the mail server information, setting mail information, and sending mails
are available.
This describes the GetALLMMLReport function. This function enables you to obtain and clear
all the MML messages in the locale buffer.
5.1.14 Function: ClearMMLBuffer
This section describes the ClearMMLBuffer function. This function enables you to clear the
MML messages in the local buffer to save system resources.
5.1.15 Function: SetMMLBufferSize
This describes the SetMMLBufferSize function. This function enables you to set the size of a
message buffer, that is, the maximum number of messages that are allowed in a buffer.
5.1.16 Example of NE Operation Function
This gives an example of the NE operation function. You can better understand how to use NE
operation functions to perform routine maintenance.
Basic Functions
The NE operation function enables you to easily maintain and manage large numbers of NEs of
various types and different versions. You can obtain NE information, issue MML commands to
NEs, obtain MML messages, and manage MML message buffers.
Function Description
5.1.2 Function: ConnectNE Selects the NE that is operated by the current task.
5.1.8 Function: GetNEVer Returns the version number of the specified NE.
Function Description
5.1.12 Function: Returns and clears the message with the specified index
GetMMLReport number in the buffer.
5.1.13 Function:
Returns and clears all MML messages in the buffer.
GetAllMMLReport
5.1.15 Function:
Sets the size of the MML message buffer.
SetMMLBufferSize
Procedure
Figure 5-1 shows how to use NE operation functions to manage NEs.
The return value of the function described in 5.1.11 Function: SendMML only shows whether the
commands are successfully issued. To check the execution details, you need to obtain the message
by calling the function described in 5.1.12 Function: GetMMLReport or 5.1.13 Function:
GetAllMMLReport.
3. Run the commands on the NE.
4. The NE returns messages which are then saved in the buffer.
Each task has an individual buffer. After an MML command is issued to the NE, the returned
MML message is saved in the buffer.
5. Obtain the message.
You can obtain the message by calling the function described in 5.1.12 Function:
GetMMLReport or 5.1.13 Function: GetAllMMLReport.
NOTE
Synopsis
ConnectNE(NEName)
Note
l You must call this function to select the required NE. Then, after the operation is complete,
you can issue commands to the NE.
l A task is created after the operation. All the operations related to this task apply to this NE.
If you need to operate other NEs, you must call this function again to select other NEs and
create new tasks.
l You can select only the NEs that are properly connected to the M2000.
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0
is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
# Connect the NE.
nename = 'rnc01'
ret = ConnectNE(nename)
O&M #41302
%%/*415*/LST VER:;%%
Version information
-------------------
--- END
Related Example
Synopsis
GetNELst()
Note
None
Parameter Description
None
Return Value
l The return value is a list. If the function is called successfully, the name list of all the NEs
managed by the M2000 is returned. Otherwise, an empty list is returned.
l Each element in the list is a string indicating the NE name.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
# Get the NE list.
nelist = GetNELst()
Result
All NEs are:
rnc01
msc01
msc02
nodeb01
Related Example
Synopsis
GetNELstByType(NEType)
Note
None
Parameter Description
Parameter Description
Return Value
l The return value is a list. If the function is called successfully, the NE name list is returned.
Otherwise, an empty string is returned.
l Each element in the list is a string indicating the NE name.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
# Get the NE list based on NE type.
rncLst = GetNELstByType("RNC")
Print('GetNELstByType("RNC") return: ')
Print(rncLst)
Result
GetNELstByType("RNC") return:
['rnc01', 'rnc02', 'rnc03', 'rnc111', 'rnc199', 'rncd1', 'rncme', 'rncreal']
Related Example
Synopsis
GetNEName()
Note
The iSStar allows you to create multiple tasks. You can click Select NE to select multiple NEs.
Then, the system can create multiple tasks. Each task corresponds to an NE. If multiple tasks
are involved, each task can obtain the name of its NE through the GetNEName function.
Parameter Description
None
Return Value
The return value is a string. If an NE is operated for the current task, the name of the NE is
returned. Otherwise, return null strings.
Error Handling
If errors occur, you can obtain error information by referring to 5.10.2 Function:
GetLastError and 5.10.3 Function: GetErrorMsg.
Example
#Connect the NE rnc001.
ConnectNE("rnc001")
Result
name: rnc001
Related Example
Synopsis
GetNEFDN([NEName])
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is a string.
l If you have specified the NE, its FDN is returned.
l If no NE is specified but an NE is operated, the FDN of this NE is returned.
l If no NE is specified, no NE is operated, or the specified NE does not exist, a null string is
returned.
NOTE
Error Handling
If errors occur, you can obtain error information by referring to 5.10.2 Function:
GetLastError and 5.10.3 Function: GetErrorMsg.
Example 1
#Connect the NE rnc001.
ConnectNE("rnc001")
Result of Example 1
fdn: .0.1.177
Example 2
#Get the FDN of the NE rnc001.
fdn = GetNEFDN("rnc001")
Result of Example 2
fdn: .0.1.177
Related Example
Synopsis
GetNEIP([NEName])
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is a string.
l If you have specified the NE, its IP address is returned.
l If no NE is specified but an NE is operated, the IP address of this NE is returned.
l If no NE is specified, no NE is operated, or the specified NE does not exist, a null string is
returned.
NOTE
Error Handling
If errors occur, you can obtain error information by referring to 5.10.2 Function:
GetLastError and 5.10.3 Function: GetErrorMsg.
Example 1
#Connect the NE rnc001.
ConnectNE("rnc001")
Result of Example 1
ip: 200.200.200.200
Example 2
#Get the IP address of the connected NE.
ip = GetNEIP("rnc001")
Result of Example 2
ip: 200.200.200.200
Related Example
Synopsis
GetNEVer([NEName])
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string.
l If you have specified the NE, its version number is returned.
l If no NE is specified but an NE is operated, the version number of this NE is returned.
l If no NE is specified, no NE is operated, or the specified NE does not exist, a null string is
returned.
NOTE
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example 1
#Connect the NE ne1.
ConnectNE("ne1")
Result of Example 2
GetNEVer() return:
BSCNEV100R006ENGC01B071
Related Example
Synopsis
GetNEType([NEName])
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string.
l If you have specified the NE, its NE type is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example 1
#Connect the NE ne1.
ConnectNE("ne1")
Result of Example 2
GetNEType() return:
RNC
Related Example
Synopsis
GetNEStatus([NEName])
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the NE is connected, 1 is returned. Otherwise, 0 is returned.
Error Handling
If errors occur, you can obtain error information by referring to 5.10.2 Function:
GetLastError and 5.10.3 Function: GetErrorMsg.
Example 1
#Connect the NE rnc001.
ConnectNE("rnc001")
Result of Example 1
neStatus: 1
Example 2
#Get the status of the NE rnc001.
neStatus = GetNEStatus("rnc001")
Result of Example 2
neStatus: 1
Related Example
Synopsis
SendMML(MMLCmd)
Note
l Call 5.1.2 Function: ConnectNE to select the NE to be operated before calling this
function.
l You can only use SendMML to issue MML commands to the NE that supports MML.
l Issuing MML commands to the NE being upgraded might fail.
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, 1 is returned. Otherwise, 0 is
returned.
NOTE
You can use the 5.2 MML Message Parsing Function function to view the MML message. Thus, you
can obtain the information about the execution of the MML commands on the NE.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastErrorand 5.10.3 Function:
GetErrorMsg.
Example
#Connect the NE neName.
ConnectNE("neName")
Result
SendMML("LST CELL:;") success.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
11 11 302 3812E 1 3 0
12 12 302 3812E 2 3 0
(Number of results = 5)
--- END
Related Example
Synopsis
GetMMLReport([Idx])
Note
l After an MML command is issued to the NE, the returned MML message is saved in the
buffer. Each task has an individual buffer. You can set the buffer size by referring to 5.1.15
Function: SetMMLBufferSize.
l The messages accumulates in the buffer. When the number of stored messages exceeds the
maximum, new messages are lost. You need to obtain and clear the messages in the buffer.
l After a task is complete, the corresponding buffer is cancelled and the messages are deleted.
l The messages in a buffer are identified by the location index. The location index starts from
0 and increases in sequence. After you extract a message with the position index as a, it is
deleted from the buffer. Then, the location indexes that are greater than a are changed
correspondingly. For example, four messages, 0, 1, 2, and 3 are available in the buffer.
After you extract message 1, the location position of message 2 changes to 1 and the location
position of message 3 changes to 2.
Parameter Description
Parameter Description
Idx Idx is the index of the delivering time of MML message and counts
from 0.
The default value is 0. When Idx is equal to -1, the obtained message
is the return message of the latest delivered MML command.
Return Value
The return value is a string. If the function is called successfully, the message content is returned
and the message is deleted from the buffer. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Connect the NE ne1.
ConnectNE("ne1")
@LST OP:;
@LST CELL:;
@LST CELL:;
Result
The third report :
+++ NE 2006-12-19 20:48:50
O&M #8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 CELL1 1 NODEB1 0 3
1 CELL2 1 NODEB1 1 3
(Number of results = 2)
--- END
Operator info
-------------
Operator name Status IP Address Service Login Time
--- END
Operator info
-------------
Operator name Status IP Address Service Login Time
--- END
0 CELL1 1 NODEB1 0 3
1 CELL2 1 NODEB1 1 3
(Number of results = 2)
--- END
0 CELL1 1 NODEB1 0 3
1 CELL2 1 NODEB1 1 3
(Number of results = 2)
--- END
Related Example
Synopsis
GetAllMMLReport()
Note
l For the tasks that may generate MML messages, each one has an individual buffer. You
can set the buffer size by referring to 5.1.15 Function: SetMMLBufferSize.
l The MML messages accumulates in the buffer. When the number of stored messages
exceeds the maximum, new messages are lost. You need to obtain and clear the messages
in the buffer.
l After a task is complete, the buffer is cancelled and the messages are deleted.
Parameter Description
None.
Return Value
l The return value is a list.
l The elements in the list are the obtained MML messages.
Error Handling
Obtain the error information through 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Connect the NE ne1.
ConnectNE('ne1')
Result
There are 2 reports:
Report = +++ NE 2008-01-10 15:01:31
O&M #1426
%%/*6718*/LST OP:;%%
RETCODE = 0 Operation succeeded
Operator info
-------------
Operator name Status IP Address Service Login Time
--- END
0 CELL1 1 NODEB1 0 3
1 CELL2 1 NODEB1 1 3
(Number of results = 2)
--- END
Operator info
-------------
Operator name Status IP Address Service Login Time
--- END
0 CELL1 1 NODEB1 0 3
1 CELL2 1 NODEB1 1 3
(Number of results = 2)
--- END
Related Example
Synopsis
ClearMMLBuffer()
Note
l After an MML command is issued to the NE, the returned MML messages are saved in the
buffer. Each task has an individual buffer. You can set the buffer size by referring to 5.1.15
Function: SetMMLBufferSize.
l If you do not invoke the 5.2.3 Function: ParseMMLRpt function to parse the MML
messages or invoke the ClearMMLBuffer function to clear the buffer of MML messages
after the MML command is issued, the MML messages accumulates in the buffer. When
the number of stored messages exceeds the maximum that is set in 5.1.15 Function:
SetMMLBufferSize, new messages are lost, and thus new MML commands fail to be
issued. Therefore, you need to invoke the 5.2.3 Function: ParseMMLRpt function to
parse the MML messages or invoke the ClearMMLBuffer function to clear the buffer of
MML messages in time.
Parameter Description
None.
Return Value
The return value is an integer. If all the messages are cleared from the buffer, the value 1 is
returned. Otherwise, the value 0 is returned.
Error Handling
If errors occur, you can obtain the error information by referring to 5.10.2 Function:
GetLastError and 5.10.3 Function: GetErrorMsg.
Example
#Connect the NE ne1.
ConnectNE("ne1")
returncode = ClearMMLBuffer()
Print('ClearMMLBuffer() return: ' + str(returncode))
Related Example
Synopsis
SetMMLBufferSize([Len])
note
l After an MML command is issued to an NE, the returned MML message is saved in a
buffer. Each task has an individual buffer.
l The messages accumulates in the buffer. When the number of stored messages exceeds the
maximum, new messages are lost.
l The SetMMLBufferSize(len) function can initialize the buffer, that is, clear the existing
messages in it.
Parameter Description
Parameter Description
Len is an integer and >= -1, with the default value as 1000.The
following different values for len have different meanings:
l When len is equal to -1, you can infer that all messages are allowed
in the buffer.
Len
l When len is equal to 0, messages are not buffered.
l When len is greater than 0, the value of len is the maximum number
of allowable messages in the buffer. After the value of len reaches
the maximum, MML commands cannot be issued.
Return Value
The return value is a string. If the function is called successfully, 1 is returned. Otherwise, 0 is
returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
ConnectNE('ne1')
Result
The number of mml reports is : 1
O&M #5852
%%/*117775*/LST VER:;%%
Version information
------------------------
--- END
Related Example
Scenario
In daily OM work, you need to check whether NEs run normally and submit a check report. You
can use the iSStar to check the operation of a certain type of NEs. For example, you are required
to check the hard disk usages of the BAMs on all the NEs of the ABC type. If the remaining
hard disk space is lower than 50%, you can infer that the NE does not run properly. Then, you
need to provide the information about the NE name, disk drive, total space, remaining space,
and rate of the remaining space. If the remaining space is higher than 50%, no output information
is required.
Procedure
1. By using the 5.1.4 Function: GetNELstByType function, check the names of the all the
NEs of the ABC type.
2. By using the 5.1.2 Function: ConnectNE function, specify the NEs that issue the MML
commands.
3. By using the 5.1.11 Function: SendMML function, issue the MML command for querying
the hard disk usage of each NE.
4. By using the 5.1.13 Function: GetAllMMLReport function, obtain the message returned
by the MML command in the buffer.
5. By using the 5.2 MML Message Parsing Function function, parse the message and obtain
the data of the remaining space of each disk.
6. Use the Print function to print the obtained data on the output window.
Task Script
Print("Routine health check starts")
if not neList
Print("The ABC NE does not exist.")
Exit(0)
end
#Define a function.
#Check the usage of the hard disks through parsing the returned message.
def parseReport(report)
mmlParser = CreateMMLParser(report)
# Get the list of hard disks of the BAM. The message of hard disks corresponds to the second en
objIndex = 1
hardDiscNum = GetRecordNum(mmlParser, objIndex)
for hdIndex in range(hardDiscNum)
freeSpaceValue = GetAttrValueByName(mmlParser, objIndex, "Free space(%)", hdIndex)
# Convert the string of free space into an integer. Determine whether the free space meets
freeSpace = int(freeSpaceValue[:-1])
# Get the driver of the hard disk that did no pass the check.
hardDisc = GetAttrValueByName(mmlParser, objIndex, "Logical harddisk", hdIndex)
Print("The free space of hard disk %s is %s. The free space is insufficient. Please han
return False
end
end
return True
end
# "List of the NEs whose free space of hard disk is lower than 50%"
resultNeList = []
for ne in neList
Print("Checking the NE %s"%ne)
if ( ConnectNE(ne) == SUCCESS)
Print("Sending commands to query...")
if( SendMML("DSP BAMSRV:;") == SUCCESS)
report = GetMMLReport()
Print("Check result")
if not parseReport(report)
# Record the NE that doesn't pass the check
resultNeList.append(ne)
end
else
Print("Command failed")
end
else
Print("Connecting the NE %s failed"%ne)
end
end
# Print the list of the NEs whose free space of hard disk is lower than 50%
if resultNeList
Print("List of NEs whose free hard disk spaces are lower than 50%")
Print(resultNeList)
else
Print("The free hard disk space of all checked NEs are greater than 50%")
end
Result
Routine health check starts.
List of NEs whose free space of hard disks are lower than 50%.
['NE96']
(Number of results = 2)
--- END
Basic Functions
An NE returns an MML message after it runs MML commands. An MML message contains
two types of information. One is the information about MML commands, such as execution
status and result data. The other is the information about MML messages, such as output time
and serial number. By using the MML message parsing functions, you can obtain and output the
message information in the tuple format, which can be used for report output.
Table 5-2 lists the MML message parsing functions.
FunctiPon Description
FunctiPon Description
5.2.19 Function: Returns the list of attribute names in the specified entry
GetAttrNameList in an MML message.
5.2.24 Function: Returns the contents of the specified entry and output
GetDataFrmMMLRpt the contents in the tuple format.
Procedure
Figure 5-2 shows how to use the MML message parsing functions to obtain the message
contents.
(1) Start identifiers of an An MML message must start with "+++" as its start
MML message. identifiers.
(2) Source identity A source identity identifies the physical area where an
(equipment output message is generated. You can specify the
identification). identity when installing the equipment.
It can be obtained through 5.2.4 Function:
GetSourceName.
(4) Creation time of an MML The 24 hour clock mode is applied. The expression
message. format is HH:MM:SS.
It can be obtained through 5.2.6 Function:
GetReportTime.
(5) Service message flag of A service message flag is used to identify the service
an MML message. type of a message. The meanings of the service report
flags are as follows:
l TRAFFIC
Performance report. Only the performance reports
that are actively reported are of the TRAFFIC type.
The query reports of performance data are of the
O&M type rather than TRAFFIC.
l O&M
Operation and maintenance report. All session
outputs, for example, service configuration and
alarm query, belong to the O&M type.
l TEST
Test report. Only the test reports that are actively
reported are of the TEST type. The query reports of
test data are of the O&M type rather than TEST.
l ALARM
Alarm report. Only the alarm reports that are actively
reported are of the ALARM type. The query reports
of test data are of the O&M type rather than
ALARM.
It can be obtained through 5.2.8 Function:
GetServiceFlag.
(6) Serial number. The message serial number maps a task. It uniquely
identifies the output message of a task.
For a command that has large command results, the
output needs to be divided into multiple messages
which use the same message serial number. In this way,
the serial number can identify the messages of the same
task.
It can be obtained through 5.2.9 Function:
GetReportIdx.
(7) Command echo. The echo of an MML command shows the issued MML
command. The password echo is "*****", namely, five
English star symbols. If an MML message is displayed
as multiple sub-messages, the command echoes of all
the sub-messages are the same.
It can be obtained through 5.2.10 Function:
GetMMLCmd.
(8) Return code. A return code identifies whether the NE system has
successfully processed the MML commands. A return
code is represented by a 32-bit decimal positive integer.
The value 0 indicates that the system process is
successful. Other return codes are defined by the NE
applications.
It can be obtained through 5.2.11 Function:
GetResultCode.
(9) Remarks of a return code. If the command is successfully run, the remark shows
success. If a command is not successfully run, the
remark gives the cause, which helps locate the error.
It can be obtained through 5.2.12 Function:
GetResultCause.
(11) Attribute of entry 0. Obtain the attribute list of the entry through 5.2.19
Function: GetAttrNameList.
(14) Record 1 of entry 0. You can obtain the number of records of an entry by
calling 5.2.15 Function: GetRecordNum.
(15) Sum information of entry The sum information shows the number of records in
0. the body.
You can obtain the number of records of an entry by
calling 5.2.15 Function: GetRecordNum.
(18) MML message. You can obtain the MML message by using 5.1.12
Function: GetMMLReport. You can obtain a group
of MML messages and clear the buffer by using 5.1.13
Function: GetAllMMLReport. You can create a
parsing object flag by using 5.2.3 Function:
ParseMMLRpt.
l For integrity purpose, the tips of the MML message of certain commands provide further
explanation. Tips are displayed before the end mark, and before the additional information,
if any. If an end mark does not follow the tip, a blank line separates the tip from the
subsequent information. If the output MML message is divided into several sub-messages,
the remark is displayed in the last sub-message only. It can be obtained through 5.2.16
Function: GetTips.
l Additional information is displayed before the end identifier of the message. If a command
generates only one MML message, the additional information can be omitted. If the output
of the command result is divided into several MML messages, the additional information
is mandatory.
l The time offset value and time adjustment flag are available in English MML message only.
You can obtain the time adjustment flag by using 5.2.7 Function: GetTimeAdjustFlag.
If time adjustment is not required, the flag does not exist in the MML message.
CAUTION
The indexes of entries, attributes, and records of an MML message count from 0.
Synopsis
ParseMMLRpt(MMLRpt)
Note
l The return values of the ParseMMLRpt function is the MML message parsing objects. The
MML message parsing objects are necessary for other message parsing functions.
Therefore, you need to invoke this function before invoking other message parsing
functions.
l After parsing the MML message parsing objects returned by the ParseMMLRpt function,
you need to invoke the 5.2.25 Function: DestroyMMLParser function to destroy the
MML message parsing objects in time. It is recommended that you not invoke the
ParseMMLRpt function to create new MML message parsing objects before the created
MML message parsing objects are destroyed. Otherwise, other messages may not be
correctly parsed.
Parameter Description
Parameter Name Parameter Description
Return Value
If the function is invoked successfully, MML message parsing objects are returned. Otherwise,
the value None is returned.
Error Handling
If errors occur, you can obtain the error information by referring to 5.10.2 Function:
GetLastError and 5.10.3 Function: GetErrorMsg.
Example
ConnectNE("NE001")
@LST VER:;
mml = GetMMLReport()
Synopsis
GetSourceName(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the source identity of the MML
message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++ NE 2008-01-15 12:04:00
O&M #286
%%/*8326*/LST OP:;%%
RETCODE = 0 Execution succeeded.
Operator info
-------------
Operator name Status IP Address Service Login Time
--- END
'''
p = ParseMMLRpt(mml) # Parse the MML message.
sourceName = GetSourceName(p) # Get the source equipment identifier from the parsed MML messag
Result
GetSourceName() return: NE
Related Example
Synopsis
GetReportDate(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
Parameter Description
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
11 11 302 3812E 1 3 0
12 12 302 3812E 2 3 0
(Number of results = 5)
--- END
'''
p = ParseMMLRpt(mml)
reportDate = GetReportDate(p) # Get the message date from the parsed MML message.
Result
GetReportDate() return: 2007-06-21
Related Example
Synopsis
GetReportTime(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the creation time of the MML
message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++ 2007-04-12 15:58:18
O&M; #812669
%%/*15343*/LST VER:;%%
RETCODE = 0 Execution succeeded.
Version information
-------------------
Product version = BSC6800V100R008ENGC01B060
--- END
'''
Result
GetReportTime() return: 15:58:18
Related Example
Synopsis
GetTimeAdjustFlag(pMMLRpt)
Note
The GetTimeAdjustFlag(pMMLRpt) function enables you to obtain the time adjustment flag, if
any. If there is no such record in the message, a null string is returned.
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the time adjustment flag is
returned. Otherwise, a null string is returned.
DST is an abbreviation for daylight saving time. It is one hour earlier than the current time.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = """
+++ RNC 2006-12-19 20:48:50 +DST
O&M #8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 CELL1 1 NODEB1 0 3 0 0
1 CELL2 1 NODEB1 1 3 0 128
2 CELL3 1 NODEB1 2 3 0 127
3 CELL4 1 NODEB1 3 3 0 126
4 CELL5 2 NODEB2 4 3 0 125
5 CELL6 2 NODEB2 5 3 0 124
6 CELL7 2 NODEB2 6 3 0 123
10 CELL10 1 NODEB1 10 3 0 1
(Number of results = 8)
--- END
"""
p = ParseMMLRpt(mml)
adjust = GetTimeAdjustFlag(p)
Print("GetTimeAdjustFlag(p) return: " + adjust)
Result
GetTimeAdjustFlag(p) return: DST
Related Example
Synopsis
GetServiceFlag(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the service flag of the MML
message is returned. Otherwise, a null string is returned.
Performance report. Only the performance reports that are actively reported are of the
TRAFFIC type. The query reports of performance data are of the O&M type rather than
TRAFFIC.
l O&M
OM report. All session outputs, for example, service configuration and alarm query, belong
to the O&M type.
l TEST
Test report. Only the test reports that are actively reported are of the TEST type. The query
reports of test data are of the O&M type rather than TEST.
l ALARM
Alarm report. Only the alarm reports that are actively reported are of the ALARM type.
The query reports of test data are of the O&M type rather than ALARM.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = """
+++ NE 2007-12-07 10:13:53
O&M #71476
%%/*570*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
--- END
"""
p = ParseMMLRpt(mml)
Result
GetServiceFlag(): O&M
Related Example
Synopsis
GetReportIdx(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the serial number of the message
is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = """
+++ NE 2007-12-07 10:13:53
O&M #71476
%%/*570*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
--- END
"""
Result
GetReportIdx() : 71476
Related Example
Synopsis
GetMmlCmd(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the obtained command echo
is returned. Otherwise, a null string is returned.
The echo of an MML command shows the issued MML command. The password echo is *****,
that is, five asterisks. If an MML message is displayed as multiple sub-messages, the command
echoes of all the sub-messages are the same.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The MML command output of an alarm message is: LST ALMAF: CNT=0;
Related Example
Synopsis
GetResultCode(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the return code is returned.
Otherwise, a null string is returned.
If the return code is 0, you can infer that the commands have been successfully processed. Other
return codes are defined by the related NEs.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = """
+++ NE 2007-12-07 10:13:53
O&M #71476
%%/*570*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
--- END
"""
Result
GetResultCode() return: 0
Related Example
Synopsis
GetResultCause(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the remarks of the return code
is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = """
+++ NE 2007-12-07 10:13:53
O&M #71476
%%/*570*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
--- END
"""
Result
GetResultCause() return: Execution succeeded.
Related Example
Synopsis
GetObjNum(pMMLRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the function is called successfully, the number of entries in the
MML message is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = """
+++ NE 2007-12-07 10:13:53
O&M #243
%%/*570*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 4)
--- END
"""
Result
GetObjNum() return: 1
Related Example
Synopsis
GetObjTitle(pMMLRpt, ObjIndex)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is successfully called, the title of the specified entry
is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = """
+++ NE 2007-12-07 10:13:53
O&M #243
%%/*570*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
--- END
"""
Result
GetObjTitle() return: List cell basic information
Related Example
Synopsis
GetRecordNum(pMMLRpt, ObjIndex)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the function is called successfully, the obtained number of
records is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml='''
+++ NE 2007-12-07 10:13:53
O&M #243
%%/*599*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
--- END
'''
p = ParseMMLRpt(mml)
Print("GetRecordNum = "+ str(GetRecordNum(p, 0))) #Get and output the number of records in entry
Result
GetRecordNum()= 6
Related Example
Synopsis
GetTips(pMMLRpt)
Note
This function enables you to obtain the alarm tips in an MML message. If no alarm tips are
available in the MML message, a null string is returned.
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the tip is returned. Otherwise,
a null string is returned.
A tip gives further description of a command. For example, the command for querying the bill
pool of the active server requires all modules to return the results. If a module link is
disconnected, the related information cannot be queried. In an MML message, the information
about which module has no response is shown in a tip.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++ NE 2007-12-07 10:13:53
O&M #71476
%%/*3745*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
Hints
-----
some words
--- END
'''
p = ParseMMLRpt(mml)
Print("GetTips() return: "+ str(GetTips(p))) #Get and output the tips.
Result
GetTips() return: some words
Related Example
Synopsis
GetAttrValueByName(pMMLRpt, ObjIndex, PropName, RecordIdx,Case = 0)
Note
None
Parameter Description
Parameter Description
ObjIndex ObjIndex is an integer. It indicates the index of the entries of the MML
message. The Nth object in the MML message refers to the Nth MML
message.
Return Value
The return value is a string. If the function is called successfully, the obtained attribute value is
returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++ NE 2007-12-07 10:13:53
O&M #243
%%/*617*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812
1 1 300 3812
20 20 301 BBU
10 10 302 3812E
12 12 302 3812E
15 3802 3802 3802
(Number of results = 6)
--- END
'''
p = ParseMMLRpt(mml)
#Get and output the attribute value of record 1 with the attribute name “Cell ID” in entry 0.
Print("GetAttrValueByName = "+ str(GetAttrValueByName(p,0,"Cell ID",1)))
Result
GetAttrValueByName() = 1
Related Example
Synopsis
GetAttrValueByIdx(pMMLRpt, ObjIndex, PropIndex, RecordIdx)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the obtained attribute value is
returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++ NE 2007-12-07 10:13:53
O&M #243
%%/*617*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 0 300 3812 0 3 0
1 1 300 3812 1 3 0
20 20 301 BBU 0 3 0
10 10 302 3812E 0 3 0
12 12 302 3812E 2 3 0
15 3802 3802 3802 0 3 0
(Number of results = 6)
--- END
'''
p = ParseMMLRpt(mml)
#Get and output the attribute value of record 0 inf attribute 0 in entry 0.
Print("GetAttrValueByIdx = "+ str(GetAttrValueByIdx(p,0,0,2)))
Result
GetAttrValueByIdx() = 20
Related Example
Synopsis
GetAttrNameList(pMMLRpt, ObjIndex)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string list. If the function is called successfully, the list of the attribute
names in the specified entry is returned. Otherwise, an empty list is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++ 2007-04-12 17:22:13
O&M; #813231
%%/*17449*/LST BAMIPRT:;%%
RETCODE = 0 Execution succeeded.
--- END
'''
p = ParseMMLRpt(mml)
attrNames = GetAttrNameList(p,0) #From the parsed MML message, get the name list of the attribut
Result
GetAttrNameList() return: ['Destination network address', 'Destination address
mask', 'Forward route address']
Related Example
Synopsis
GetAttrNum(pMMLRpt, ObjIndex)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the function is called successfully, the number of attributes in
the specified entry is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++ 2007-04-12 16:36:19
O&M; #813086
%%/*16553*/LST BRD: SRN=5;%%
RETCODE = 0 Execution succeeded.
Subrack No. = 5
Slot No. = 1
Board type = WFMR
(Number of results = 2)
--- END
'''
p = ParseMMLRpt(mml)
attrNum = GetAttrNum(p,0) #From the parsed MML message, get the number of attributes in entry 0.
Result
GetAttrNum() return: 3
Related Example
Synopsis
GetColumnByName(mParser, objIndex, columnName, ignoreCase)
Note
None.
Description
Parameter Description
Return Value
The return value is of string sequence type. If the function is called successfully, the data of a
column in the specified entry is returned. Otherwise, a null string is returned.
Error Handling
None.
Example
mml = """
+++ RNC 2006-12-19 20:48:50
O&M #8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 CELL1 1 NODEB1 0 3 0 0
1 CELL2 1 NODEB1 1 3 0 128
2 CELL3 1 NODEB1 2 3 0 127
3 CELL4 1 NODEB1 3 3 0 126
4 CELL5 2 NODEB2 4 3 0 125
5 CELL6 2 NODEB2 5 3 0 124
6 CELL7 2 NODEB2 6 3 0 123
10 CELL10 1 NODEB1 10 3 0 1
(Number of results = 8)
--- END
"""
p = ParseMMLRpt(mml)
col1 = GetColumnByName(p, 0, 'Cell name')
for v in col1
Print(v)
end
Result
CELL1
CELL2
CELL3
CELL4
CELL5
CELL6
CELL7
CELL10
Synopsis
GetColumnByIndex(mParser, objIndex, columnIndex )
Note
None.
Description
Parameter Description
Return Value
The return value is a string sequence. If the function is successfully called, the data of the
specified column in the specified entry is returned. Otherwise, a null string is returned.
Error Handling
None.
Example
mml = """
+++ RNC 2006-12-19 20:48:50
O&M #8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 CELL1 1 NODEB1 0 3 0 0
1 CELL2 1 NODEB1 1 3 0 128
2 CELL3 1 NODEB1 2 3 0 127
3 CELL4 1 NODEB1 3 3 0 126
4 CELL5 2 NODEB2 4 3 0 125
5 CELL6 2 NODEB2 5 3 0 124
6 CELL7 2 NODEB2 6 3 0 123
10 CELL10 1 NODEB1 10 3 0 1
(Number of results = 8)
--- END
"""
p = ParseMMLRpt(mml)
col3 = GetColumnByIndex(p, 0, 3)
for v in col3
Print(v)
end
Result
NODEB1
NODEB1
NODEB1
NODEB1
NODEB2
NODEB2
NODEB2
NODEB1
Synopsis
GetRowByIndex(mParser, objIndex, rowIndex)
Note
None.
Description
Parameter Description
Return Value
The return value is of string sequence type. If the function is called successfully, the data of a
record in the specified entry is returned. Otherwise, a null string is returned.
Error Handling
None.
Example
mml = """
+++ RNC 2006-12-19 20:48:50
O&M #8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
0 CELL1 1 NODEB1 0 3 0 0
1 CELL2 1 NODEB1 1 3 0 128
2 CELL3 1 NODEB1 2 3 0 127
3 CELL4 1 NODEB1 3 3 0 126
4 CELL5 2 NODEB2 4 3 0 125
5 CELL6 2 NODEB2 5 3 0 124
6 CELL7 2 NODEB2 6 3 0 123
10 CELL10 1 NODEB1 10 3 0 1
(Number of results = 8)
--- END
"""
p = ParseMMLRpt(mml)
row = GetRowByIndex(p, 0, 0)
for v in row
Print(v)
end
Result
0
CELL1
1
NODEB1
0
3
0
0
H'2512(9490)
Synopsis
GetDataFrmMMLRpt(mParser, objIndex, columnIndexList)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a tuple (title, two-dimensional list). The title is a string. The two-dimensional
is a common two-dimensional tuple, for example, [[...], [...], [...], ...]. For details of tuples, refer
to Tuple. For details of two-dimensional lists, refer to List.
Error Handling
None
Example
mml = """
+++ RNC 2006-12-19 20:48:50
O&M #8522
%%/*2116*/LST CELL:;%%
0 CELL1 1 NODEB1 0 3 0 0
1 CELL2 1 NODEB1 1 3 0 128
2 CELL3 1 NODEB1 2 3 0 127
3 CELL4 1 NODEB1 3 3 0 126
4 CELL5 2 NODEB2 4 3 0 125
5 CELL6 2 NODEB2 5 3 0 124
6 CELL7 2 NODEB2 6 3 0 123
10 CELL10 1 NODEB1 10 3 0 1
(Number of results = 8)
--- END
"""
p = ParseMMLRpt(mml)
for r in data
for v in r
Print(v)
end
Print('-------------')
end
Result
List cell basic information
Cell ID
Cell name
NodeB ID
NodeB name
Local cell ID
Subrack No.
Subsystem No.
DL primary scrambling code
Location area code
-------------
0
CELL1
1
NODEB1
0
3
0
0
H'2512(9490)
-------------
1
CELL2
1
NODEB1
1
3
0
128
H'2512(9490)
-------------
2
CELL3
1
NODEB1
2
3
0
127
H'2512(9490)
-------------
3
CELL4
1
NODEB1
3
3
0
126
H'2512(9490)
-------------
4
CELL5
2
NODEB2
4
3
0
125
H'2512(9490)
-------------
5
CELL6
2
NODEB2
5
3
0
124
H'2512(9490)
-------------
6
CELL7
2
NODEB2
6
3
0
123
H'2512(9490)
-------------
10
CELL10
1
NODEB1
10
3
0
1
H'2512(9490)
-------------
Synopsis
DestroyMMLParser(mparser)
Note
It is advised that you call this interface when handling a mass of MM messages to avoid
exceptions during the parsing of MM messages.
Parameter Description
Parameter Description
Return Value
If you delete the parsing object successfully, 1 is returned. If you fail to delete the parsing object,
0 is returned.
Error Handling
If errors occur, you can obtain error information by referring to Function: GetLastError and
Function: GetErrorMsg.
Example
ConnectNE("rnc001")
@LST VER:;
mml = GetMMLReport()
p = ParseMMLRpt(mml)
success=DestroyMMLParser(p)
if success == 1
Print("destroy success")
end
Result
destroy success
Scenario
In routine maintenance work, you always need to check the status of a subrack on a frame and
output the types and states of the boards on the slots of this subrack.
Procedure
1. By using the 5.1.2 Function: ConnectNE and 5.1.11 Function: SendMML functions,
issue MML commands to the NEs to be operated and query the subrack status.
2. By using the 5.1.12 Function: GetMMLReport function, obtain the message returned by
the MML command in the buffer.
3. By using the 5.2 MML Message Parsing Function function, parse the message and obtain
the information about the status of each frame.
4. By using the Function: NewReport, Function: AddSheet, Function: AddTable,
Function: SetTableValue, and Function: SaveReportAs functions, save the parsing
results to an .xls report.
Example
Print('*************Subrack status check starts *************')
if ConnectNE('rnc1') == 0
Print('Failed to connect the NE. Please check whether the NE is disconnected.')
Exit(0)
end
# If the MML message did not return success, the processing is stopped.
if not parser or GetResultCode(parser) != '0'
Print('The information about the subrack of the current NE is unavailable. exit.')
Exit(1)
end
if GetObjNum(parser) < 1
Print('The information about the subrack of the current NE is unavailable.exit.')
Exit(2)
end
# From the obtained parsing object, get the title and data information (a two-dimensional list
title, tb = GetDataFrmMMLRpt(parser, 0)
# Create a table.
tId = AddTable(sId, len(tb), len(tb[0]), title)
Result
*************Subrack status check starts *************
Starting to check the NE. Please wait...
Precautions
The script of the previous task exports a report in .xls format to the output directory.Figure
5-4lists the elements in the report.
This describes the ParseAlmRpt function. This function enables you to parse an alarm message
and convert it into a format that can be recognized by other alarm message parsing functions.
You need to call this function before calling other alarm message parsing functions.
5.3.4 Function: GetAlmSource
This describes the GetAlmSource function. This function enables you to obtain the source
identity of an alarm message. A source identity is used for identifying the physical area where
an alarm is generated.
5.3.5 Function: GetAlmRptDate
This describes the GetAlmRptDate function. This function enables you to get the create date of
an alarm report.
5.3.6 Function: GetAlmRptTime
This describes the GetAlmRptTime function. This function enables you to obtain the generation
time of an alarm message.
5.3.7 Function: GetAlmRptNum
This describes the GetAlmRptNum function. This function enables you to obtain the number of
entries in an alarm message. Entry n refers to alarm n, where n is an entry of the alarm message.
5.3.8 Function: GetAlmServiceTag
This describes the GetAlmServiceTag function. This function enables you to obtain the service
message flag of the specified alarm.
5.3.9 Function: GetAlmTimeAdjustFlag
This describes the GetAlmTimeAdjustFlag function. This function enables you to obtain the
time adjustment flag of an alarm message.
5.3.10 Function: GetAlmServiceFlag
This describes the GetAlmServiceFlag function. This function enables you to obtain the service
message flag of an alarm message. The service message flag is ALARM.
5.3.11 Function: GetAlmRptIdx
This describes the GetAlmRptIdx function. This function enables you to obtain the serial number
of an alarm message. A serial number uniquely identifies an alarm message.
5.3.12 Function: GetAlmMMLCmd
This describes the GetAlmMMLCmd function. This function enables you to obtain the MML
command output of an alarm message.
5.3.13 Function: GetAlmResultCode
This describes GetAlmResultCode function. This function enables you to obtain the return codes.
5.3.14 Function: GetAlmResultCause
This describes the GetAlmResultCause function. This function enables you to obtain the
information about the return code of an alarm message.
5.3.15 Function: GetAlmTips
This describes the GetAlmTips function. This function enables you to get the tips of an alarm
message.
5.3.16 Function: GetAlmFlowNumber
This describes the GetAlmFlowNumber function. This function enables you to obtain the alarm
flow number of the specified alarm in an alarm message. Alarm flow numbers are serial numbers
sequenced by the alarm generation time.
5.3.17 Function: GetAlmType
This describes the GetAlmType function. This function enables you to obtain the alarm category
of the specified alarm. Alarm category is defined by alarm nature. Alarms can be categorized
into fault alarm and event alarm.
5.3.18 Function: GetAlmLevel
This describes the GetAlmLevel function. This function enables you to obtain the alarm severity
of the specified alarm in an alarm message. Alarm severity is used for identifying the impact of
the alarm on the service. Four types are available: critical, major, minor, and warning.
5.3.19 Function: GetAlmNEType
This describes the GetAlmNEType function. This function enables you to obtain the NE type
of the specified alarm. NE type is used for identifying the type of the NE that generates an alarm.
5.3.20 Function: GetAlmID
This describes the GetAlmID function. This function enables you to obtain the alarm ID of the
specified entry in an alarm message.Alarm ID is used for identifying the same type of alarms.
For the same product, the alarm ID is unique for one type of alarms.
5.3.21 Function: GetAlmSort
This describes the GetAlmSort function. This function enables you to obtain the alarm name of
the specified alarm. The following alarm types are available: power system, environment system,
signaling system, relay system, hardware system, software system, running system, Qos,
handling error, and internal NM system.
5.3.22 Function: GetAlmSyncSerialNo
This describes the GetAlmSyncSerialNo function. This function enables you to obtain the alarm
synchronization number of the specified alarm. Alarm synchronization number is used for
synchronizing the alarm from Manager to Agent. Each alarm has one and only one alarm
synchronization number.
5.3.23 Function: GetAlmName
This describes the GetAlmName function. This function enables you to obtain the alarm name
of the specified alarm. An alarm name briefly describes an alarm.
5.3.24 Function: GetAlmRaiseTime
This describes the GetAlmRaiseTime function. This function enables you to obtain the
generation time of the specified alarm.
5.3.25 Function: GetAlmLocationInfo
This describes the GetAlmLocationInfo function. This function enables you to obtain the alarm
location information about the Index alarm in an alarm message. The location information helps
identify the object that generates the alarm.
5.3.26 Function: GetAlmAttrValueByName
This describes the GetAlmAttrValueByName function. This function enables you to obtain the
attribute value of the Index entry in an alarm message.
5.3.27 Function: GetAlmAttrValueByIdx
This describes the GetAlmAttrValueByIdx function. This function enables you to obtain the
value of specified attribute of the specified alarm in an alarm message.
5.3.28 Function: GetAlmNumByLevel
This describes the GetAlmNumByLevel function. This function enables you to obtain the
number of alarms of the specified severity.
5.3.29 Function: GetAlmNumByTimeDur
This describes the GetAlmNumByTimeDur function. This function enables you to obtain the
number of alarms in a specified period.
Basic Functions
After the M2000 issues alarm MML commands to an NE, the NE returns an alarm message. An
alarm message is an MML message that contains alarm information. An alarm message includes
the following items: source identifier, creation date, creation time, service message flag, time
adjustment flag, flow number, alarm category, alarm severity, and alarm ID. By using alarm
message parsing functions, you can obtain the information about an alarm message, thus
facilitating the related maintenance.
Table 5-4 lists the alarm message parsing functions.
Function Description
5.3.14 Function: GetAlmResultCause Returns the information about the return codes
of an alarm message.
The remarks of a return code is contained in a
system report. The system report refers to the
returned message which indicates whether the
system has successfully processed the alarm
message.
If the command is successfully run, the remark
shows success. If a command is not
successfully run, the remark gives the cause.
This helps you to locate the error.
Function Description
5.3.15 Function: GetAlmTips Returns the tips of an alarm message. For some
commands, you need to provide detailed
explanations in the form of tips for integrity
purpose.
5.3.16 Function: GetAlmFlowNumber Returns the alarm flow number of the specified
alarm in an alarm message. Alarm flow
numbers are serial numbers sequenced by the
alarm generation time.
5.3.21 Function: GetAlmSort Returns the alarm type of the specified alarm.
The following alarm types are available:
power system, environment system, signaling
system, relay system, hardware system,
software system, running system, Qos,
handling error, and internal NM system.
5.3.23 Function: GetAlmName Returns the alarm name of the specified alarm.
An alarm name briefly describes an alarm.
Function Description
Procedure
Figure 5-5 shows how to use the alarm message parsing functions to obtain the alarm message
contents.
Figure 5-6 shows the format of an alarm message. For details of Figure 5-6, see Table 5-5.
(2) Source identity A source identity is used for identifying the physical area
(equipment where an alarm is generated. It can be obtained through
identification) 5.3.4 Function: GetAlmSource.
(4) Service message flag The service message flag is ALARM. It can be obtained
through 5.3.10 Function: GetAlmServiceFlag.
(6) Command echo of an The command echo of an MML command displays the
MML command in issued MML command. It can be obtained through 5.2.10
an alarm message Function: GetMMLCmd.
(7) Return code A return code identifies whether the NE system has
successfully processed the MML commands. A return code
is represented by a 32-bit decimal positive integer. The
value 0 indicates that the system process is successful.
Other return codes are defined by the NE applications.
It can be obtained through 5.3.13 Function:
GetAlmResultCode.
(8) Remarks of a return If the command is successfully run, the remark shows
code success. If a command is not successfully run, the remark
gives the cause, which helps locate the error.
It can be obtained through 5.3.14 Function:
GetAlmResultCause.
(10) Flow number of An alarm flow number identifies the sequence of the alarms
alarm 0 generated on an NE. It can be obtained through 5.3.16
Function: GetAlmFlowNumber.
(11) Alarm category of Alarm category is defined by the alarm nature. Alarms can
alarm 0 be categorized into fault alarm and event alarm. It can be
obtained through 5.3.17 Function: GetAlmType.
(12) Alarm severity of Alarm severity indicates the degree of impact on the
alarm 0 service. Four types are available: critical, major, minor, and
warning. It can be obtained through 5.3.18 Function:
GetAlmLevel.
(13) NE type of alarm 0 NE type indicates the type of the NE where an alarm is
generated. It can be obtained through 5.3.19 Function:
GetAlmNEType.
(14) Alarm ID of alarm 0 Alarm ID is used for identifying alarms of the same type.
For the same product, the alarm ID is unique for one type
of alarms. It can be obtained through 5.3.20 Function:
GetAlmID.
(15) Alarm type of alarm Alarm type is used for identifying the source of an alarm,
0 such as:
l Power system
l Environment system
l Signaling system
l Relay system
l Hardware system
l Software system
l Running system
l Communications system
l QoS
l Handling error
l Internal NM system
It can be obtained through 5.3.21 Function:
GetAlmSort.
(16) Basic attributes of an The basic attributes include service message identity, flow
alarm number, alarm type, alarm severity, NE type, alarm ID, and
alarm type.
(17) Attribute name An alarm message contains the following items: alarm
synchronization number, alarm name, alarm generation
time, and location information. Some alarm messages also
contain detailed description, alarm cause, handling
suggestions, restoration type, and restoration time.
(20) Alarm name An alarm name briefly describes an alarm. Its length cannot
exceed 100 English characters. It can be obtained through
5.3.23 Function: GetAlmName.
(21) Alarm generation Alarm generation time refers to the time when an alarm is
time generated on a device. The format is YYYY-MM-DD
HH:MM:SS. It can be obtained through 5.3.24 Function:
GetAlmRaiseTime.
(22) Alarm location Alarm location information uniquely identifies the object
information of an alarm. It can be obtained through 5.3.25 Function:
GetAlmLocationInfo.
Location information is composed of multiple sub-items
which are separated by , , that is, an English comma and an
English space. The format if each item is Item=Item
value.
l Item describes the location field, for example, subrack
No., and board No. It is composed of Chinese characters,
English letters, numbers, or English underscores.
l Item value describes the location field value. It is
composed of Chinese characters, English letters, or
numbers.
(23) Entry 0 Alarm 0 You can obtain the number of entries in an alarm
message by calling 5.3.7 Function: GetAlmRptNum.
(27) Alarm message You can create a message parsing object by calling 5.3.3
Function: ParseAlmRpt.
CAUTION
The indexes of entries, attributes, and records of an alarm message count from 0.
Synopsis
ParseAlmRpt(AlmRpt)
Note
The return value of the ParseAlmRpt function is the parsing object of the alarm message. The
parsing object of the alarm message is necessary for other alarm message parsing functions.
Therefore, you need to call this function before calling other alarm message parsing functions.
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the function is called successfully, the alarm message resolving
object is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information through 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 4)
--- END
"""
Result
ParseAlmRpt(strAlarm) return: <AlarmParser.AlarmParser instance at 0x0A4BB508>
Related Example
Synopsis
GetAlmSource(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the identity of the alarm message
is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
Alarm source is:NE
Related Example
Synopsis
GetAlmRptDate(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the creation date of the alarm
message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The create date of an alarm report is: 2006-01-04
Related Example
Synopsis
GetAlmRptTime(pAlmRpt)
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the generation time of the
message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The generation time of an alarm message is: 11:35:56
Related Example
Synopsis
GetAlmRptNum(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the number of entries in the
alarm message is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The number of alarm reports is: 3
Related Example
Synopsis
GetAlmServiceTag(pAlmRpt, Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the service message flag of the
specified alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
(Number of results = 3)
--- END
"""
Result
The alarm service of the specified alarm is: ALARM
Related Example
Synopsis
GetAlmTimeAdjustFlag(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the time adjustment code of
the alarm message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Related Example
Synopsis
GetAlmServiceFlag(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the service message flag of the
alarm message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
Result
The alarm service flag is: ALARM
Related Example
Synopsis
GetAlmRptIdx(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the serial number of the alarm
message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The index of the alarm report is: 27232
Related Example
Synopsis
GetAlmMMLCmd(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the command output is
displayed. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
GetAlmMMLCmd(p) return: LST ALMAF: CNT=0;
Related Example
Synopsis
GetAlmResultCode(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the information about the return
codes of the alarm message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The return code of an alarm message is: 0
Related Example
Synopsis
GetAlmResultCause(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the information about the return
codes of the alarm message is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Print('The information about the return code of an alarm message is: ' + fl)
Result
The information about the return code of an alarm message is: Execution succeeded.
Related Example
Synopsis
GetAlmTips(pAlmRpt)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the tips of the alarm message
is returned. otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Related Example
Synopsis
GetAlmFlowNumber(pAlmRpt,Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm flow number is
returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
Print('The alarm flow number of the Index alarm in the alarm message is: ' + fl)
Result
The alarm flow number of the Index alarm in the alarm message is: 67984
Related Example
Synopsis
GetAlmType(pAlmRpt, Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm catetory of the
specified alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
Result
The alarm type of the specified alarm is: Fault
Related Example
Synopsis
GetAlmLevel(pAlmRpt,Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm severity of the
specified alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
Result
The severity of the Index alarm is: Major
Related Example
Synopsis
GetAlmNEType(pAlmRpt,Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the NE type of the specified
alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
Print('The NE type of the 0th alarm in the alarm message is:' + netype)
Result
The NE type of the 0th alarm in the alarm message is: RNC
Related Example
Synopsis
GetAlmID(pAlmRpt,Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm ID is returned.
Otherwise, an empty string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
Print('The alarm ID of the 1st entry in the alarm message: ' + almId)
Result
The alarm ID of the 1st entry in the alarm message: 1802
Related Example
Synopsis
GetAlmSort(pAlmRpt,Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm catetory of the
specified alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
sort = GetAlmSort(p, 0) #Get the alarm type of alarm 0.
Result
The alarm sort of the specified alarm is: Hardware
Related Example
Synopsis
GetAlmSyncSerialNo(pAlmRpt,Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm synchronization
number of the specified alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
p = ParseAlmRpt(strAlarm)
serial = GetAlmSyncSerialNo(p, 1) #Get the alarm synchronization number of alarm 1.
Print("The alarm's sync serial No. of the 1st alarm is: " + serial)
Result
The alarm's sync serial No. of the 1st alarm is: 110145
Related Example
Synopsis
GetAlmName(pAlmRpt,Index)
Note
An alarm name can contain a maximum of 1000 English characters.
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm name of the specified
alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The alarm name of the 2th alarm is: SAAL Link Unavailable
Related Example
Synopsis
GetAlmRaiseTime(pAlmRpt,Index)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm generation time of
the specified alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The raising time of the Index alarm is: 2005-12-27 15:06:50
Related Example
Synopsis
GetAlmLocationInfo(pAlmRpt,Index)
Note
The alarm location information field indicates the physical or service object of the alarm, which
includes all the necessary elements that can help locate the alarm object. Users can determine a
unique alarm object based on the location information. According to the sequence of human
perception, the location information is arranged in a descending order, for example, NE -> rack
-> subrack -> board.
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the alarm location information
of the specified alarm is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Print('The alarm location information about the Index alarm in the alarm message is : ' + locInfo)
Result
The alarm location information about the Index alarm in the alarm message is :
Subrack No.=3, Slot No.=8
Related Example
Synopsis
GetAlmAttrValueByName(pAlmRpt, Index, PropName, Case = 0))
Note
None
Parameter Description
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the value of the specified
attribute is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
#Get the attribute value of the alarm named “Sync serial No.” in alarm 0.
propvalue = GetAlmAttrValueByName(p, 0, "Sync serial No.")
Print("The attribute value(Sync serial No.) of the Index entry in the alarm message is: " + propva
Result
The attribute value(Sync serial No.) of the Index entry in the alarm message is:
110134
Related Example
Synopsis
GetAlmAttrValueByIdx(pAlmRpt,Index,PropIndex)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the value of the specified
attribute is returned. Otherwise, a null string is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Print('The 2nd value of attribute Index of the specified alarm in the alarm message is: ' + propva
Result
The 2nd value of attribute Index of the specified alarm in the alarm message is:
2005-12-27 15:06:50
Related Example
Synopsis
GetAlmNumByLevel(pAlmRpt, Level, Case = 0)
Note
None
Parameter Description
Parameter Description
Parameter Description
Return Value
The return value is a string. If the function is called successfully, the number of alarms of the
specified severity is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
The number of alarms of the specified severity(major) is: 3
Related Example
Synopsis
GetAlmNumByTimeDur(pAlmRpt,Start,Stop)
Note
GetAlmNumByTimeDur(pAlmRpt,Sart,Stop) enables you to obtain the number of alarms in
specified period. The stop time must be later than the start time.
Parameter Description
Parameter Description
Start Start is a string. It indicates the start time. The valid range
is from 2000-01-01 00:00:00 to 2037-12-31 23:59:59.
Stop Stop is a string. It indicates the end time. The valid range
is from 2000-01-01 00:00:00 to 2037-12-31 23:59:59.
Return Value
The return value is a string. If the function is called successfully, the number of alarms in the
specified period is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
#Get the number of alarms generated between “2005-12-27 15:06:50” and “2005-12-27 15:06:59”.
num = GetAlmNumByTimeDur(p, "2005-12-27 15:06:50", "2005-12-27 15:06:59")
Result
The number of alarms in a specified period is: 1
Related Example
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 4)
--- END
"""
showAlmInfoByIndex(strAlarm, 0)
Result
The flownumber of alarm No 0: 67984
The alarm type of alarm No 0: Fault
The alarm level of alarm No 0: Major
The type of the NE of alarm No 0: RNC
strAlarm = """
+++ NE 2006-01-04 11:35:56
ALARM #27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
(Number of results = 3)
--- END
"""
Result
An Major alarm happended at 2005-12-27 15:07:27 .
This describes the QueryCmRcds function, which enables you to get the queried configuration
data records.
5.4.9 Function: NextCmRcds
This describes the NextCmRcds() function, which enables you to obtain the configuration data
queried through QueryCmRcds().
5.4.10 Function: GetCmCom
This describes the GetCmCom(Fdn,objSeq) function, which enables you to obtain the
configuration data of the specified object.
5.4.11 Function: GetChildMoc
This describes the GetChildMoc function, which enables you to obtain the child MOC and the
attribute list.
5.4.12 Function: GetIntegrityReportCond
This describes the GetIntegrityReportCond function. This function enables you to obtain
integrity query conditions.
5.4.13 Function: GetFunctionSubSetList
This describes the GetFunctionSubSetList function. This function enables you to obtain the list
of function subsets, including their IDs and names.
5.4.14 Function: QueryIntegrityResult
This describes the QueryIntegrityResult function. This function enables you to query an integrity
result based on the integrity query conditions.
5.4.15 Function: GetOneNEInteLst
This describes the GetOneNEInteLst function. This function enables you to obtain the integrity
result of a specified NE from the integrity query results.
5.4.16 Function: GetOneFssInte
This describes the GetOneFssInte function. This function enables you to obtain the integrity
report of a specified function subset from an NE integrity report.
5.4.17 Function: GetOneIntegrity
This describes the GetOneIntegrity function. This function enables you to obtain the integrity
result of a specified NE or a function subset from an integrity report.
5.4.18 Function: GetPmCond
The GetPmCond function is used to create performance query conditions that contain only
default values. After creating performance query conditions, you can set data items for specific
query conditions based on the actual requirement.
5.4.19 Function: GetFmCond
The GetFmCond function is used to create an alarm query condition that contains only default
values. After creating an alarm query condition, you can set data items for a specific query
condition based on the actual requirement.
5.4.20 Function: QueryRecord
The QueryRecord function is used to query the performance data or alarm data that meets the
query conditions.
5.4.21 Function: RecordCount
The RecordCount function is used to obtain the records returned by the QueryRecord function.
5.4.22 Function: NextRecord
The NextRecord function is used to obtain the records obtained by the QueryRecord function.
Basic Functions
By using the database operation functions, you can easily establish the connection with the
database of the M2000 data center. In this way, you can quickly obtain the alarm data,
performance data, and configuration data.
CAUTION
The iSStar and theM2000 use the same connection channel to access the M2000 database. If
you frequently use the iSStar database operation functions to access the M2000 database, the
load of both the M2000 system and database becomes high. Thus, it is recommended that you
run the iSStar script or perform the task that contain a large amount of database operations in
low traffic hours of the M2000 system. In addition, do not frequently access the M2000 database
within a short period of time.
Function Description
5.4.4 Function: QueryFmRcds Returns the alarms that meet the conditions.
5.4.33 Function: CloseDB Closes the connection with the M2000 data center.
5.4.12 Function:
Obtains integrity query conditions.
GetIntegrityReportCond
Function Description
5.4.30 Function: GetMoiListByFil- Query the MOIs of an MOC based on the MOC
ter name, NE FDN, and filtering conditions.
Procedure
Figure 5-7 shows how to use the database operation functions.
Synopsis
OpenDB(UserName, Password)
Note
None
Parameter Description
Parameter Description
NOTE
l If the user name and password are not entered, the database is accessed through the current client
login user and password.
l If the user name and password are entered, the database is accessed through the entered user name
and password.
l To invoke the OpenDB interface, you must enter both the user name and password, or enter neither
of them.
Return Value
The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0
is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Connect the database.
returncode = OpenDB("admin", "11111111")
Print('OpenDB() return: ' + str(returncode))
#Close the database connection.
CloseDB()
Result
OpenDB() return: 1
Synopsis
CreateCond(ENUM)
Note
None
Parameter Description
Name Description
ENUM The ENUM type is enumeration. It is the basis for creating objects
of condition objects.
ENUM = {
FM_COND, #alarm query condition ID
PM_COND, #performance query condition ID
CM_COND #configuration query condition ID
}.
Return Value
If this function is called successfully, the objects of query conditions are returned. Otherwise,
None is returned.
Error Handling
None
Example
#Connect the database.
OpenDB("admin", "11111111")
#Query the alarms that meet the condition and output the number of alarm records.
returncode = QueryFmRcds(fmcond)
Print('QueryFmRcds() return: ' + str(returncode))
Synopsis
QueryFmRcds(Fmcond)
Note
l QueryFmRcds(Fmcond) enables you to query the alarms that meet the specified conditions.
The results are sorted in the specified mode by the specified field. You can get the queried
results by calling the function NextFmRcds.
l Call the function OpenDB to connect to the database before calling this function.
Parameter Description
Parameter Description
l 2: descending order
l 1: NE time mode
NOTE
If you do not set Fmcond
[TIME_MODE], the default
value is 1.
[START_TIME]. Fmcond
[START_TIME] is a tuple
indicating the start time of the
alarm query. The time
composes year, month, day,
hour, minute, and second.
The default value indicates
querying all alarms generated
before Fmcond
[END_TIME].
NOTE
If neither the start time nor the
end time is set, all the alarm data
is queried.
l 2: mobile
l 3: fixed network
narrowband
l 4: fixed network wideband
l 5: intelligent
l 6: network management
NTTypeID: is an integer. It
indicates the NE type of the
alarm. The values and
meanings are as follows:
l 100000: OMC
l 1: RNC
l 2: NodeB
l 3: SGSN
l 4: GGSN
l 5: CG
l 6: SoftX
l 7: MGW
l 8: HLR
AlarmId: is an integer. If
alarm ID, ProductID, and
NEType are specific, an
alarm can be uniquely
identified. The value of
AlarmId can be any integer
including negative integers,
except -1.
l 2: major
l 3: minor
l 4: warning
l 6: unacknowledged
Return Value
The return value is an integer. If the function is called successfully, the number of records that
meet the querying conditions is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Related Example
Synopsis
NextFmRcds()
Note
l The NextFmRcds function enables you to obtain the alarm data that is queried by 5.4.4
Function: QueryFmRcds. Each time 200 alarm data records are returned. If the number
of the returned records exceeds 200, you need to use the NextFmRcds function for multiple
times to return all the alarm data. If the number does not reach 200, all the alarm data is
returned at a time.
l Call 5.4.2 Function: OpenDB to connect to the database before calling this function.
Parameter Description
None.
Return Value
The return value is a set of custom objects. Each set contains a maximum of 2,000 data records
at a time. You can traverse each data through interaction. An example of the code is as follows:
FmRecords = NextFmRcds()
while FmRecords
for fm in FmRecords
......
end
FmRecords = NextFmRcds() end
Each record is a custom object and has its own attributes. Table 5-8 describes the attributes.
You can access the object attributes in the format of ".attribute name" in the script. For example,
in the previous code, you can access the Category attribute of fm in the format of fm.Category.
Attribute Description
Attribute Description
Attribute Description
Error Handling
If errors occur, you can obtain the error information by referring to Function: GetLastError and
Function: GetErrorMsg.
Example
#################################################
#
# parse one record of the alarm data#
# Input:record #
#
#################################################
def detail(record)
Print('Category:' + str(record.Category))
Print('DevFdn: ' + str(record.DevFdn))
Print('NE: (' + str(record.NE.ProctID) + ', ' + str(record.NE.NEType) + ', ' + str(record.NE.ob
Print('DevCsn: ' + str(record.DevCsn))
Print('CSN: ' + str(record.Csn))
Print('Id: ' + str(record.Id))
Print('Type: ' + str(record.Type))
Print('Level: ' + str(record.Level))
Print('Restore: ' + str(record.Restore))
Print('Confirm: ' + str(record.Confirm))
Print('Operator: ' + str(record.Operator))
i = []
for p in record.Paras
i.append(p)
end
Print('Paras: ' + str(i))
Print('ExtendInfo: ' + str(record.ExtendInfo))
Print('LinkObjId: ' + str(record.LinkObjId))
Print('LinkType: ' + str(record.LinkType))
Print('ReasonId: ' + str(record.ReasonId))
Print('ClearOperator: ' + str(record.ClearOperator))
Print('Raise Time: (' + str(record.dtRaise.dt.year) + ', ' \
+ str(record.dtRaise.dt.month) + ', ' + str(record.dtRaise.dt.day) + ',' \
+ str(record.dtRaise.dt.hour) + ', ' + str(record.dtRaise.dt.minute) + ',' \
+ str(record.dtRaise.dt.second) + '; ' + str(record.dtRaise.timezoneOffset) + ',' \
+ str(record.dtRaise.dstTimeOffset) + ')')
Print('Acknowledge Time: (' + str(record.dtAck.dt.year)+', ' \
+ str(record.dtAck.dt.month) + ', ' + str(record.dtAck.dt.day) + ',' \
+ str(record.dtAck.dt.hour) + ', ' + str(record.dtAck.dt.minute) + ',' \
+ str(record.dtAck.dt.second) + '; ' + str(record.dtAck.timezoneOffset) + ',' \
+ str(record.dtAck.dstTimeOffset) + ')')
Print('Clear Time: (' + str(record.dtClear.dt.year)+', ' \
+ str(record.dtClear.dt.month) + ', ' + str(record.dtClear.dt.day) + ',' \
+ str(record.dtClear.dt.hour) + ', ' + str(record.dtClear.dt.minute) + ',' \
+ str(record.dtClear.dt.second) + '; ' + str(record.dtClear.timezoneOffset) + ',' \
+ str(record.dtClear.dstTimeOffset) + ')')
end
#Set alarm types, which include current fault alarms, event alarms, and history fault alarms.
fmcond[ALARM_CATE] = 1
# Set alarm conditions such as product types, NE types, and alarm IDs.
fmcond[ALARMINFO_SEQ] = [(2,7,1815)]
fdn=GetNEFDN('msc_yang')
Print(fdn)
#Set the FDN of the NE
fmcond[NEFDN_SEQ] = list(fdn)
#Set alarm severities, which can be critical, major, minor, warning, and uncertain.
fmcond[ALARMLEVEL_SEQ] = [2]
#Query the alarms that meet the condition and output the number of alarm records.
returncode = QueryFmRcds(fmcond)
Print('QueryFmRcds() return: ' + str(returncode))
detail(fm)
end
FmRecords = NextFmRcds()
end
Result
Acknowledge Time: (0, 0, 0,0, 0,0; 0,0)
Clear Time: (2008, 12, 10,12, 9,29; 480,0)
Category:1
DevFdn: .OMCNE.0.10
NE: (6, 100000, .OMCNE.0)
DevCsn: 1200
CSN: 7158
Id: 301
Type: 11
Level: 1
Restore: 1
Confirm: 0
Operator:
Paras: [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
ExtendInfo: neName = bsc6000, neIP = 10.121.45.78, neErrPort = 6000, neErrCode = N/
A, neErrMsg = closed by peer
LinkObjId:
LinkType: -1
ReasonId: 0
ClearOperator: < NE operator >
Raise Time: (2008, 12, 10,12, 5,30; 480,0)
...
Synopsis
QueryPmRcds(Pmcond)
Note
l QueryPmRcds(Pmcond) enables you to query performance data records. You can get the
performance results by calling the function NextPmRcds.
l Call the functionOpenDB to connect to the database before calling this function.
Parameter Description
Parameter Description
l 1: M2000
l 2: LMT
NE_TYPEID l 3: NodeB
l 4: RNC
l 5: MSCServer
l 6: MGW
l 7: SGSN
l 8: GGSN80
l 9: HLR
l 10: CG
l 17: SGSN_MML
l 1: NE time mode
The default value is 0.
l 1: YESTERDAY
l 2: THISWEEK
l 3: LASTWEEK
l 4: SPEC
TIME_DEFAULT
l 5: ALL
The default value is 5,
indicating querying all
performance data generated
at all times. Only when
timedefault=SPEC, the time
specified by pmcond
[START_TIME] and
pmcond[END_TIME] serves
as query condition. In other
cases, the query condition is
the default value of pmcond
[TIME_DEFAULT].
PERIOD l 1: 15 minutes
l 2: 30 minutes
l 3: 60 minutes
l 4: 1440 minutes
The default value is 2, that is,
the period defaults 30
minutes.
Return Value
The return value is an integer. If calling the function succeeds, the number of performance
records is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Related Example
Synopsis
NextPmRcds()
Note
l NextPmRcds() enables you to obtain the queried performance data through 5.4.4 Function:
QueryFmRcds. Each time 2000 records are returned. If the number of performance records
exceeds 2000, call the function for multiple times to return all the performance data. If the
number of performance records does not reach 2000, all the performance data is returned.
l Call 5.4.2 Function: OpenDB to connect to the database before calling this function.
Parameter Description
None
Return Value
The return value is a set of custom objects. Each set contains a maximum of 2,000 data records
at a time. You can traverse each record through interaction. An example of the code is as follows:
FmRecords = NextPmRcds()
while PmRecords
for fm in PmRecords
......
end
PmRecords = NextPmRcds()
end
Each record is a custom object and has its own attributes. Table 5-10 describes the attributes.
You can access the object attributes in the format of ".attribute name" in the script. For example,
in the previous code, you can access the "Category" attribute of "fm" in the format of
"fm.Category".
Attribute Description
Attribute Description
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Open the database connection.
OpenDB("admin", "11111111")
#Create an object of performance query.
pmcond = CreateCond(PM_COND)
#Set the start time of the time segment for performance data query.
pmcond[START_TIME] = (2006, 12, 29, 18, 24, 39, 1, 1)
#Set the end time of the time segment for performance data query.
pmcond[END_TIME] = (2006, 12, 30, 10, 20, 40, 2, 1)
Result
QueryPmRcds() return:3498
Synopsis
QueryCmRcds(Cmcond)
Note
l QueryCmRcds(Cmcond) enables you to get the queried configuration data records. Get the
queried result by calling 5.4.9 Function: NextCmRcds.
l Before calling this function, call 5.4.2 Function: OpenDB to connect the database.
Parameter Description
Parameter Description
Cmcond Cmcond is the query condition object. It is the return value of calling
CreateCond(CM_COND).
The items of Cmcond are enumeration values, that is, {PARENT_ID,
NE_FDN, CHILD_MOC}. The meanings are as follows:
l ParentObjId: ID of parent managed object (MO). Cmcond
[ParentObjId] is a long integer. You can set it through Cmcond
[ParentObjId].
l NE_FDN: FDN of an NE. Cmcond[NE_FDN] is a string. You can set
it through Cmcond[NE_FDN].
l CHILD_MOC: name of child manage object class (MOC). Cmcond
[CHILD_MOC] is a string. You can set it through Cmcond
[CHILD_MOC].
Return Value
The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0
is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Related Example
Synopsis
NextCmRcds()
Note
l NextCmRcds() enables you to obtain the configuration data queried through 5.4.8
Function: QueryCmRcds. Each time 1000 records are returned. If the number of
configuration records exceeds 1000, call the function for multiple times to return all the
alarm data. If the number of alarm records does not reach 1000, all the configuration data
is returned.
l Call 5.4.2 Function: OpenDB to connect to the database before calling this function.
Parameter Description
None
Return Value
The return value is a list. If calling this function succeeds, the configuration data list is returned
and the elements in the lists are of long integer type. Otherwise, an empty list is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Open the database connection.
OpenDB("admin", "11111111")
Print("")
Print("----------### Query the configuration ####----------")
cmcond = CreateCond(CM_COND)
cmcond[PARENT_ID] = 3223011329
cmcond[NE_FDN] = '.3221229568.3221233664.3221291041'
cmcond[CHILD_MOC] = 'RNCOriginSigPoint'
ee = QueryCmRcds(cmcond)
Result
----------### Query the configuration ####----------
CM result:2360
Synopsis
GetCmCom(Fdn,objSeq)
Note
l GetCmCom(Fdn,objSeq) enables you to obtain the configuration data of the specified
object. Obtain the queried results through 5.4.9 Function: NextCmRcds.
l Call 5.4.2 Function: OpenDB to connect to the database before calling this function.
Parameter Description
Parameter Description
Fdn Fdn is a string. It indicates the NE FDN. If the list is empty, the
return value is the configuration data of the root MO.
Return Value
The return value is a list. If calling the function succeeds, the configuration data is returned.
Otherwise, an empty list is returned.
The return value of GetCmCom() is a list. The configuration data of the specified object ID is
returned.
The return value is: MoDataSeq = [MoData, MoData1, MoData2, ...]. MoData is of MO data
type. It has the following elements: objId, mocName, displayMocName, name, and groupSeq.
The meaning of each element is as follows:
l objId: long integer type. It indicates the ID of the MO object in the configuration data.
l MocName: character type. It indicates the name of MOC.
l displayMocName: string type. It indicates the display name of MOC.
l name: character type. It indicates the name of MO.
l groupSeq: list type. The elements in the list are attribute groups. The list is: groupSeq =
[group, group1, ...]. The element group is the attribute group which has two elements:
groupName and data. The meaning of each element is as follows:
– groupName: string type. It indicates the name of the attribute group.
– data: List type. It indicates results of the attributes in the attribute list.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Connect the database.
OpenDB("admin", "11111111")
#sNeFdn,oidSeq
returncode = GetCmCom('.3221229568.3221233664.3221278720', [3221291008, 3221295104])
Print('GetCmCom() return recordCount: ' + str(len(returncode)))
Synopsis
GetChildMoc(NEFdn, ParentMoc)
Note
Call 5.4.2 Function: OpenDB to connect to the database before calling this function.
Parameter Description
Parameter Description
NEFdn NEFdn is a string. It indicates the NE FDN which uniquely identifies the
configuration data.
ParentMoc ParentMoc is a string. It indicates the name of the parent managed object
class (MOC).
Return Value
The return value is a list. If the function is called successfully, the attribute list of parent MOC
is returned. Otherwise, an empty list is returned.
NOTE
The return value of GetChildMoc() is a list. The elements in the list are the types of MOC data objects.
The return value can be represented by [Moc, Moc1, ...]. An MOC has three attributes: name, displayName,
and attrInfoGroups. The meanings are as follows:
l name: string type. It indicates the name of the MOC.
l displayName: string type. It indicates displayed MOC name.
l attrInfoGroups: list type. attrInfoGroups = [attrInfoGroup, attrInfoGroup1, ...], where attrInfoGroup
is of attribute information group object type indicating the attribute information group of MOC.
attrInfoGroup = [attrInfo, attrInfo1, ...], where attrInfo is of attribute information object type and
contains three elements: name, displayName, and attrtype:
l name: string type. It indicates the attribute name.
l displayName: string type. It indicates the displayed attribute name.
l attrtype: enumeration type. It indicates the attribute type. The value 0 indicates the integer type;
1 indicates the double type; 2 indicates the string type.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Connect the database.
OpenDB("admin", "11111111")
retlist = GetChildMoc('.3221229568.3221233664.3221278720', 'RncEquipment')
Print('GetChildMoc() return recordCount: ' + str(len(retlist)))
Synopsis
GetIntegrityReportCond()
Note
None.
Parameter Description
None.
Return Value
The return value is the object of the integrity query conditions. The following table describes
the attributes and meanings of the return value. You can set the specific attributes of the objects
of query conditions in the format of ".attribute name" in the script.
Attribute Description
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
cond = GetIntegrityReportCond()
cond.neTypeName = 'RNC'
cond.period=0
cond.neFDNList=['.3221229568.3221233664.3221282816','.3221229568.3221233664.3221282817','.32212
cond.FssIdList=[67109391,67109473,67109395,6710943]
cond.timeMode=0
cond.startTime=(2008, 8, 4, 10, 0, 0)
cond.endTime=(2008, 8, 4, 16, 0, 0)
li = QueryIntegrityResult(cond)
l = GetOneNEInteLst(li,'.3221229568.3221233664.3221282842')
t = GetOneFssInte(l,67109473)
d = GetOneIntegrity(li,'.3221229568.3221233664.3221282842',67109391)
Print(d)
Result
fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100;
Synopsis
GetFunctionSubSetList(neTypeName)
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is a list of function subsets, whose form is as follows: [function subset ID1:
"function subset name 1", function subset ID2: "function subset name 2"…].
Error Handling
If errors occur, you can obtain the error information by referring to Function: GetLastError and
Function: GetErrorMsg.
Example
resList = GetFunctionSubSetList('RNC')
keyList = resList.keys()
for key in keyList
Print(str(key) + ": " + resList[key])
end
Result
67109376: Measurement of RAB release triggered by UTRAN per cell
67109377: Measurement of multi-RAB service per cell
67109378: Measurement of RB Procedure per cell
67109379: Soft Handover Measurement per cell
67109380: Hard Handover Measurement per cell
67109381: InterRAT Handover Measurement per cell
67109382: Cell Update Measurement per cell
67109383: URA Update Measurement per cell
67109384: RRC Reporting Measurement per cell
...
Synopsis
QueryIntegrityResult(IntegrityReportCond)
Note
None.
Parameter Description
Parameter Description
IntegrityReport Refers to the integrity query conditions, which can be set through 5.4.12
Cond Function: GetIntegrityReportCond.
Return Value
The return value is an integrity report.
Error Handling
If errors occur, you can obtain the error information by referring to Function: GetLastError and
Function: GetErrorMsg.
Example
#Set querying condition
cond = GetIntegrityReportCond()
cond.neTypeName = 'RNC'
cond.period=0
cond.neFDNList=['.3221229568.3221233664.3221282816','.3221229568.3221233664.3221282817','.32212
cond.FssIdList=[67109391,67109473,67109395,6710943]
cond.timeMode=0
cond.startTime=(2008, 8, 4, 10, 0, 0)
cond.endTime=(2008, 8, 4, 16, 0, 0)
Result
result length is: 5
Synopsis
GetOneNEInteLst(resultNeIntegrityLst, neFdn)
Note
None.
Parameter Description
Parameter Description
resultNeIntegri Refers to the integrity result, which may contain the integrity results of
tyLst multiple NEs. This parameter value is the return value of 5.4.14 Function:
QueryIntegrityResult.
Return Value
The return value is the integrity result of a specified NE.
Error Handling
If errors occur, you can obtain the error information by referring to Function: GetLastError and
Function: GetErrorMsg.
Example
cond = GetIntegrityReportCond()
cond.neTypeName = 'RNC'
cond.period=0
cond.neFDNList=['.3221229568.3221233664.3221282816','.3221229568.3221233664.3221282817','.32212
cond.FssIdList=[67109391,67109473,67109395,6710943]
cond.timeMode=0
cond.startTime=(2008, 8, 4, 10, 0, 0)
cond.endTime=(2008, 8, 4, 16, 0, 0)
li = QueryIntegrityResult(cond)
l = GetOneNEInteLst(li,'.3221229568.3221233664.3221282842')
Print("one ne integrity report number is: " + str(len(l)))
Result
one ne integrity report number is: 3
Synopsis
GetOneFssInte(integrityNE, fssId)
Note
None.
Parameter Description
Parameter Description
integrityNE Refers to an NE integrity report. The parameter value is the return value of
5.4.15 Function: GetOneNEInteLst.
Return Value
The return value is the integrity value of a specified function subset of an NE.
Error Handling
If errors occur, you can obtain the error information by referring to Function: GetLastError and
Function: GetErrorMsg.
Example
cond = GetIntegrityReportCond()
cond.neTypeName = 'RNC'
cond.period=0
cond.neFDNList=['.3221229568.3221233664.3221282816','.3221229568.3221233664.3221282817','.32212
cond.FssIdList=[67109391,67109473,67109395,6710943]
cond.timeMode=0
cond.startTime=(2008, 8, 4, 10, 0, 0)
cond.endTime=(2008, 8, 4, 16, 0, 0)
li = QueryIntegrityResult(cond)
l = GetOneNEInteLst(li,'.3221229568.3221233664.3221282842')
t = GetOneFssInte(l,67109473)
Print(t)
Result
fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100;
Synopsis
GetOneIntegrity(resultNeIntegrityLst, neFdn, fssId)
Note
None.
Parameter Description
Parameter Description
resultNeIntegri- Refers to an integrity result. This parameter value is the return value of
tyLst 5.4.14 Function: QueryIntegrityResult.
Return Value
The return value is the integrity value of a specified NE or a function subset.
Error Handling
None.
Example
cond = GetIntegrityReportCond()
cond.neTypeName = 'RNC'
cond.period=0
cond.neFDNList=['.3221229568.3221233664.3221282816','.3221229568.3221233664.3221282817','.32212
cond.FssIdList=[67109391,67109473,67109395,6710943]
cond.timeMode=0
cond.startTime=(2008, 8, 4, 10, 0, 0)
cond.endTime=(2008, 8, 4, 16, 0, 0)
li = QueryIntegrityResult(cond)
l = GetOneNEInteLst(li,'.3221229568.3221233664.3221282842')
t = GetOneFssInte(l,67109473)
d = GetOneIntegrity(li,'.3221229568.3221233664.3221282842',67109391)
Print(d)
Result
fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100;
Synopsis
GetPmCond()
Note
None.
Parameter Description
None.
Return Value
Refers to the conditions for querying performance data after the GetPmCond function is invoked
successfully. The items in the return values are enumerated values. For details about each item,
see Table 5-11.
Assume that cond is a condition for querying performance data and is created in 5.4.18 Function:
GetPmCond. You can access and set the items of cond in the following format: cond[name of
an item]. An example of the code is as follows:
cond=GetPmCond() #assign values to function subset IDs cond[FUNCTION_SUBSET]=1644179460 #assign
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
fdn=GetNEFDN('BWA140')
#Create performance query object
cond=GetPmCond()
#Set query conditiongs
cond[FUNCTION_SUBSET]=1644179460
cond[NE_FDN]=fdn
cond[COUNTERID_SEQ]=[1644625920,1644625944,1644625943]
cond[PERIOD]=P30
cond[START_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,31,03,17,00,0,1,0))
cond[END_TIME]='2009-1-21 15:00:00'
cond[TIME_DEFAULT]=SPEC
iter=QueryRecord(cond)
lens=RecordCount(iter)
Print(lens)
Resut
71
Synopsis
GetFmCond()
Note
None.
Parameter Description
None.
Return Value
Refers to the conditions for querying alarm data after the GetFmCond function is invoked
successfully. The items in the return values are enumerated values. For details about each item,
see Table 5-12.
Assume that cond is a condition for querying alarm data and is created by referring to 5.4.19
Function: GetFmCond. You can access and set the items of cond in the following format: cond
[name of an item]. An example of the code is as follows:
cond=GetPmCond() #assign values to alarm types cond[ALARM_CATE]=1 #assign values to time modes co
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
#Create alarm query object
cond=GetFmCond()
cond[START_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,29,00,00,00,0,1,0))
cond[END_TIME]=StrfTime(TIME_FORMAT,t=(2009,02,04,23,59,59,0,1,0))
#alarm type is current alarm
cond[ALARM_CATE]=1
#Time mode is server mode
cond[TIME_MODE]=0
record=QueryRecord(cond)
count=RecordCount(record)
Print(count)
Resut
71
Synopsis
QueryRecord(queryCond)
Note
None.
Parameter Description
Parameter Description
Return Value
Refers to the set of results. You can obtain each record by referring to 5.4.22 Function:
NextRecord.
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example 1
#Create alarm query object
cond=GetFmCond()
cond[START_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,29,00,00,00,0,1,0))
cond[END_TIME]=StrfTime(TIME_FORMAT,t=(2009,02,04,23,59,59,0,1,0))
#Alarm type is current alarm
cond[ALARM_CATE]=1
#Time mode is server mode
cond[TIME_MODE]=0
record=QueryRecord(cond)
count=RecordCount(record)
Print(count)
Result of Example 1
3154
Example 2
fdn=GetNEFDN('BWA140')
#Create performance query object
cond=GetPmCond()
#Set query conditions
cond[FUNCTION_SUBSET]=1644179460
cond[NE_FDN]=fdn
cond[COUNTERID_SEQ]=[1644625920,1644625944,1644625943]
cond[PERIOD]=P30
cond[START_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,31,03,17,00,0,1,0))
cond[END_TIME]='2009-1-21 15:00:00'
cond[TIME_DEFAULT]=SPEC
iter=QueryRecord(cond)
lens=RecordCount(iter)
Print(lens)
Result of Example 2
71
Synopsis
RecordCount(resultHolder)
Note
None.
Parameter Description
Parameter Description
resultHolder resultHolder refers to the results that are obtained after you invoke the
QueryRecord function by referring to 5.4.20 Function: QueryRecord.
Return Value
Refers to the records obtained through the QueryRecord function. The value is an integer.
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
#Create alarm query object
cond=GetFmCond()
cond[START_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,29,00,00,00,0,1,0))
cond[END_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,29,23,59,59,0,1,0))
record=QueryRecord(cond)
count=RecordCount(record)
Print(count)
Resut
545
Synopsis
NextRecord(resultHolder)
Note
None.
Parameter Description
Parameter Description
resultHolder resultHolder refers to the results that are obtained after you invoke the
QueryRecord function by referring to 5.4.20 Function: QueryRecord.
Return Value
Refers to one of the records that are obtained after the QueryRecord function is invoked. Each
record is a tuple and its format is (Whether to obtain the record end identifier, [record 1, record
2, ...]).
The first element in the tuples indicates whether all records are obtained and the element is a
Boolean value. The values and meanings are as follows:
l True: Indicates that the record is the last record.
l True: Indicates that the record is not the last record.
The second element in the tuples refers to the data that is queried and displayed in a list. A
maximum of 2000 elements can be contained. The elements in the list are also lists and vary
based on the situation, that is, whether the found records are alarm records or performance
records.
l If the found records are alarm records, a list whose length is 19 is returned. For descriptions
of the elements in the list, see Table 5-13.
l If the found records are performance records, a list whose length is uncertain is returned.
The first fourth elements of the list are fixed whereas the rest elements vary based on the
found performance counters. For descriptions of the elements in the list, see Table 5-14.
NOTE
Starting from the fifth element, all the elements in the list are performance counter tuples. Performance
counters are grouped into integer counters (the counter values are integers) and character counter (the
counter values are characters).
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example 1
#Create alarm query object
cond=GetFmCond()
cond[START_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,01,00,00,00,0,1,0))
cond[END_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,29,23,59,59,0,1,0))
record=QueryRecord(cond)
count=RecordCount(record)
returnCode=False
while not returnCode
returnCode,lists=NextRecord(record)
lens=len(lists)
if lens==0
break
end
#Get the first record
oneRecord=lists[0]
recordLen=len(oneRecord)
Print(oneRecord)
end
Result of Example 1
[1, 3002, '.3221229568.3221233664.3221291008', 1, '.
3221229568.3221233664.3221291008', 405, 5, 2, 0, 0, '', '', 'Site No.=0,Cell
Index.=0,Site Type=0,Site Name=please replace,Cell Name=please replace', 0, '', -1,
'2008-12-05 14:26:04', '0000-00-00 00:00:00', '0000-00-00 00:00:00']
Example 2
fdn = GetNEFDN('CBSC_241')
#fdn='.3221229568.3221233664.3221286947'
#Create performance query object
cond=GetPmCond()
#Set query conditions
cond[FUNCTION_SUBSET]=1157627909
cond[NE_FDN]=fdn
cond[COUNTERID_SEQ]=[1157627932,1157627934,1157627935,1157627936,1157627937,1157628216]
iter=QueryRecord(cond)
returnCode=False
while not returnCode
returnCode,lists=NextRecord(iter)
lens=len(lists)
if lens==0
break
end
#Get the first record
oneRecord=lists[0]
recordLens=len(oneRecord)
Print(oneRecord)
end
Result of Example 2
['2009-02-04 19:00:00', '2009-02-04 19:30:00', '', True, (1157627932, 0.0),
(1157627934, 0.0), (1157627935, 0.0), (1157627936, 0.0), (1157627937, 0.0),
(1157628216, 0.0)]
Synopsis
GetMocAttrNameList(mocName, neFdn)
Note
None.
Parameter Description
Parameter Description
Return Value
Refers to the MOC attribute names obtained through the GetMocAttrNameList function and
displayed in a list. The list format is [attrname1, attrname1, ...].
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
#Get the Fdn of the NE
neFdn=GetNEFDN('ty')
lists=GetMocAttrNameList('BSC6000NE', neFdn)
Print(lists)
Resut
['InternalId', 'InternalSubId', 'district', 'entityVersionId', 'isLocked',
'latitude', 'locationName', 'longitude', 'matchVersion', 'medPartition', 'memo',
'name', 'neID', 'neType', 'neVersion', 'omcID', 'parentMoIndex', 'productID',
'realLatitude', 'realLongitude', 'subarea', 'subnetworkID', 'userLabel',
'vendorName']
Synopsis
GetMocList(neFdn)
Note
None.
Parameter Description
Parameter Description
Return Value
Refers to the MOC name obtained through the GetMocList function. The list format is [name1,
name2, ...]. Each element in the list is a string and refers to an MOC name.
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
#Get the Fdn of the NE
fdn=GetNEFDN('ty')
moclist=GetMocList(fdn)
Print(moclist)
Resut
['BSC6000Cabinet', 'BSC6000Cell', 'BSC6000NE', 'BSC6000Service', 'BSC6000Site',
'BSC6000SiteBoard', 'BSC6000SiteCabinet', 'BSC6000SiteSubRack', 'BSC6000TRX',
'CBaseAttr']
Synopsis
GetNeObjInfo(funcSubsetId, neFdn)
Note
None.
Parameter Description
Parameter Description
neFdn neFdn is a string and refers to the NE FDN. You can obtain neFdn by
referring to 5.1.6 Function: GetNEFDN.
Return Value
Refers to the NE performance measurement objects that are obtained through the GetNeObjInfo
function. The objects are displayed in a list and the format is [neObjInfo1, neObjInfo2, ...]. Each
item in the list is a tuple and its format is (Measurement object sequence number, Measurement
object name).
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
fdn=GetNEFDN('Real_RNC_170')
neObjInfo=GetNeObjInfo(67109435,fdn)
Print(neObjInfo)
Resut
[(1835627379,'Real_RNC_170/RncFunction:All'),(1702000229,'Real_RNC_170/
RncFunction:Real_RNC_170')]
Synopsis
GetCounterInfo(funcSubsetId, period)
Note
None.
Parameter Description
Parameter Description
neTypeId neTypeId is an integer and refers to the type ID of an NE. You can obtain
the type ID of an NE by referring to 5.4.31 Function: GetPmNeType.
Return Value
Refers to the NE performance counters that are obtained through the GetCounterInfo function
and displayed in a list. The list format is [counterInfo1, counterInfo2, ...]. Each item in the list
is a tuple and its format is (Counter ID, Counter name).
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
couerInfo=GetCounterInfo(67109473,P30)
Print(couerInfo)
Resut
[(67192134, 'VS.IUB.CongUL'), (67192135, 'VS.IUB.CongDL'), (67203852,
'VS.NodeB.Ratio.of.UnavailTime.OM'), (67203853, 'VS.NodeB.UnavailTime.OM'),
(67203854, 'VS.IUB.TimeCongUL'), (67203855, 'VS.IUB.TimeCongDL')]
Synopsis
GetFuncSetList(neTypeId)
Note
None.
Parameter Description
Parameter Description
neTypeId neTypeId is an integer and refers to the type ID of an NE. You can obtain
the type ID of an NE by referring to 5.4.31 Function: GetPmNeType.
Return Value
Refers to the NE function sets that are obtained through the GetFuncSetList function and are
displayed in a list. The list format is [counterInfo1, counterInfo2, ...]. Each item in the list is a
tuple and its format is (Function set ID, Function set name).
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
funList=GetFuncSetList(4)
Print(funList)
Resut
[(67109365, 'Measurements related to Algorithm'), (67109366, 'Measurements related
to AMR'), (67109368, 'Measurements related to CPU'),...]
Synopsis
GetFuncSubSetList(funcsetId)
Note
None.
Parameter Description
Parameter Description
funcsetId funcsetId is an integer and refers to the ID of an NE function set. You can
obtain the ID of an NE function set by referring to 5.4.27 Function:
GetFuncSetList.
neTypeId neTypeId is an integer and refers to the type ID of an NE. You can obtain
the type ID of an NE by referring to 5.4.31 Function: GetPmNeType.
Return Value
Refers to the function subsets of a specified NE function set, which are obtained through the
GetFuncSubSetList function and displayed in a list. The list format is [funcSubsetInfo,
funcSubsetInfo 1, ...]. Each item in the list is a tuple and its format is (Function subset ID,
Function subset name).
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
subSetList=GetFuncSubsetList(67109365)
Print(subSetList)
Resut
[(67109391, 'Measurement related to Algorithm per cell'), (67109473, 'Measurement
related to Algorithm per NodeB')]
Synopsis
GetMoiAttrValueList(moiuni, attrList)
Note
None.
Parameter Description
Parameter Description
moiuni moiuni is a tuple whose length is 3 and whose format is (objID, moiFdn,
neFdn). The meanings of elements in the tuple are as follows:
l objId: MOI ID
l moiFdn: MOI FDN
l neFdn: NE FDN
attrList attrList is a list of attribute names. Each element in the list is a string.
NOTE
If the list of attribute names is [], that is, the list is null, it indicates that all attribute
values of this MOI are to be queried.
Return Value
Refers to the MOC attribute values obtained through the GetMoiAttrValueList function and
displayed in a list. The list format is [value1, value2, ...].
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example 1
moi=(3221987331L, '.3221287013.3221975040.3221979139.3221987331', '.3221229568.3221233664.32212
moiattr=GetMoiAttrValueList(moi,[])
Print(moiattr)
Result of Example 1
['NULL', 'NULL', 'NULL', 'NULL', 'Cabinet No.=0, Site Index=3', '116', 'NULL']
Example 2
moi=(3221987329L, '.3221287013.3221975040.3221979136.3221987328', '.3221229568.3221233664.32212
moiattr=GetMoiAttrValueList(moi,['CabinetGrpNo', 'CabinetNo', 'CabinetType', 'name', 'SiteIndex'
Print(moiattr)
Result of Example 2
['NULL', 'NULL', 'NULL', 'Cabinet No.=0, Site Index=1', 'NULL', '116']
Synopsis
GetMoiListByFilter(mocName, neFdn, attrFilters)
Note
None.
Parameter Description
Parameter Description
attrFilters attrFilters is a list of filtering condition. The list format is [filter1, filter2,
…]. Each element in attrFilters is a list whose length is 4 and whose
format is [attr1, attr2, attr3, attr4]. The descriptions of the elements are
as follows:
l attr1: Refers to an enumerated value that is used to specify the relation
between this filtering condition and the subsequent filtering condition.
The values and meanings are as follows:
– AND: The filtering condition and the subsequent filtering condition
must be met at the same time.
– AND: The filtering condition and the subsequent filtering condition
need not be met at the same time.
– End: No subsequent filtering condition exists.
l attr2: Refers to a string that is used to specify the name of an MOI
attribute. You can obtain the name of an MOI attribute by referring to
5.4.23 Function: GetMocAttrNameList.
l attr3: Refers to a string.
l attr4: Refers to an enumerated value that is used to specify the relation
between attr2 and attr3. The values and meanings are as follows:
– R: Greater than
– L: Less than
– Equal: Equal to
– Unequal: Unequal to
– BEqual: Greater than or equal to
– LEqual: Less than or equal to
NOTE
If the filtering condition is [], that is, there is no filtering condition, it indicates that
all MOIs of all MOCs are to be queried.
Return Value
Refers to the list of the MOIs obtained through the GetMoiListByFilter function. The tuple
format is [MOI1, MOI2, …]. Each element in the list is a tuple and its format is (objId, moiFdn,
neFdn). The meanings of the elements in the tuple are as follows:
l objId: MOI ID
l moiFdn: MOI FDN
l neFdn: NE FDN
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example 1
#Get the Fdn of the NE
fdn=GetNEFDN('ty')
mocuni=GetMoiListByFilter('BSC6000SiteCabinet',fdn,[])
Print(mocuni)
Result of Example 1
[(3221987328L, '.3221287013.3221975040.3221979136.3221987328', '.
3221229568.3221233664.3221287013'), (3221987329L, '.
3221287013.3221975040.3221979137.3221987329', '.
3221229568.3221233664.3221287013'), (3221987330L, '.
3221287013.3221975040.3221979138.3221987330', '.
3221229568.3221233664.3221287013'), (3221987331L, '.
3221287013.3221975040.3221979139.3221987331', '.
3221229568.3221233664.3221287013'), (3221987332L, '.
3221287013.3221975040.3221979140.3221987332', '.
3221229568.3221233664.3221287013')]
Example 2
#Get the Fdn of the NE
fdn=GetNEFDN('ty')
mocuni=GetMoiListByFilter('BSC6000SiteCabinet',fdn,[(END,'name','Cabinet No.=0, Site Index=1',E
Print(mocuni)
Result of Example 2
[(3221987329L,'.3221287013.3221975040.3221979137.3221987329','.
3221229568.3221233664.3221287013')]
Synopsis
GetPmNeType([typeName])
Note
None.
Parameter Description
Parameter Description
typeName typeName is a string and refers to the type name of an NE. This parameter
is optional.
Return Value
The information obtained through the GetPmNeType function varies based on the actual
situation, that is, whether parameters are provided when the function is invoked:
l If parameters are not provided, the information obtained through the function consists of
the names and IDs of NE types and is displayed in a list. The list format is [netypeInfo1,
netypeInfo2, ...]. Each element in the list is a tuple and its format is (NE type ID, NE type
name).
l If parameters are provided, the information obtained through the function consists of the
names and IDs of the NE types specified by typeName. The information is a tuple and its
format is (NE type ID, NE type name).
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example 1
neInfo=GetPmNeType()
Print(neInfo)
Result of Example 1
[(76, 'BSC6000'), (69, 'CBSC'), (6, 'MGW'), (5, 'MSCServer'), (3, 'NodeB'), (4,
'RNC'), (11, 'SG7000'), (7, 'SGSN'), (77, 'SPS')]
Example 2
neInfo=GetPmNeType('NodeB')
Print(neInfo)
Result of Example 2
(3, 'NodeB')
Synopsis
GetNeInfo(neFdn)
Note
None.
Parameter Description
Parameter Description
Return Value
Refers to a tuple obtained through the GetNeInfo function. The tuple format is (NE name, NE
type ID).
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
Example
neFdn='.3221229568.3221274624.3221278720'
neinfo=GetNeInfo(neFdn)
Print(neinfo)
Resut
('RNC_cjw', 1)
Synopsis
CloseDB()
Note
Call 5.4.2 Function: OpenDB to connect to the database before calling this function.
Parameter Description
None
Return Value
The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0
is returned.
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
#Connect the database.
OpenDB("admin", "11111111")
Result
CloseDB() return: 1
When maintaining and monitoring a network, you are always required to report the exceptions
occurred on the system. The alarm operation functions provided by the iSStar well assist you in
this task. The alarm information sent by the alarm sending functions are saved in the alarm
database. You can view the information about the sent alarms on the M2000 client.
Function Description
Synopsis
SendAlarm(alarmID, category, alarmInfo)
Note
This function can be used for only a remote task. It is run on the server.
Parameter Description
Parameter Description
Return Value
The return value is an integer. If this function is called successfully, 0 is returned. Otherwise, a
number rather than 0 is returned.
Error Handling
None
Example
Print("Sending an alarm:ID Alarm ID:600,Alarm type:Event alarm,:alarm detail")
Result
Sending an alarm:ID Alarm ID:600,Alarm type:Event alarm,:alarm detail
To View the Alarms,please click Monitor->Event Alarms
By using the OM operation functions provided by the iSStar, you can obtain the version
information about the current NM. In addition, you can record the operations of the codes in a
script anytime and generate operation logs. You can query the log information on the M2000
client.
Function Description
Synopsis
GetOMCVersion ()
Note
None
Parameter Description
None
Return Value
The return value is a string. If this function is called successfully, the version string is returned.
Otherwise, None is returned.
Error Handling
None
Example
version = GetOMCVersion()
Print("OMC Version is: %s"%version)
Result
OMC Version is: iManagerM2000V200R006C01B060
Synopsis
LOG_OP(opName, targetName, detailInfo, auditResult)
Note
This function can be used for only a local task. It is run on the client.
Parameter Description
Parameter Description
Parameter Description
Return Value
The return value is null.
Error Handling
None
Example
Print("operation log:operation:my op,object:OMC,details:op details,result:success")
Print("To view the Operation Logs,please Click System->Log Management->Query Operation Logs")
Result
operation log:operation:my op,object:OMC,details:op details,result:success
To view the Operation Logs,please Click System->Log Management->Query Operation
Logs
Synopsis
String2Int(value)
Note
The conversion rule of this interface is the same as that of Python. If the value is empty or the
string cannot map to an integer value, the conversion fails.
Description
Parameter Description
Return Value
The function returns a binary tuple.
l The value of the first element in the tuple is Boolean. True indicates that the type conversion
succeeds. False indicates that the type conversion fails.
l The second element is the integer value after conversion.
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
Print("================String2Int(value) Wrong====================")
Print(String2Int(''))
Print(String2Int('3.0'))
Print("================String2Int(value) Correct====================")
Print(String2Int('3'))
Print(String2Int('-3'))
Result
================String2Int(value) Wrong====================
(False, '')
(False, '3.0')
================String2Int(value) Correct====================
(True, 3)
(True, -3)
Synopsis
String2Float(value)
Note
The conversion rule of this interface is the same as that of Python. If the value is empty or the
string cannot map to a float value, the conversion fails.
Description
Parameter Description
Return Value
The function returns a binary tuple.
l The value of the first element in the tuple is Boolean. True indicates that the type conversion
succeeds. False indicates that the type conversion fails.
l The second element is the float value after conversion.
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
Print("================String2Float(value) Wrong====================")
Print(String2Float(''))
Print(String2Float('abc'))
Print("================String2Float(value) Correct====================")
Print(String2Float('3.0'))
Print(String2Float('0.5'))
Result
================String2Float(value) Wrong====================
(False, '')
(False, 'abc')
================String2Float(value) Correct====================
(True, 3.0)
(True, 0.5)
Synopsis
String2Long(value)
Note
The conversion rule of this interface is the same as that of Python. If the value is empty or the
string cannot map to a long value, the conversion fails.
Description
Parameter Description
Return Value
The function returns a binary tuple.
l The value of the first element in the tuple is Boolean. True indicates that the type conversion
succeeds. False indicates that the type conversion fails.
l The second element is the long value after conversion.
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
Print("================String2Long(value) Wrong====================")
Print(String2Long(''))
Print(String2Long('3.0'))
Print("================String2Long(value) Correct====================")
Print(String2Long('3'))
Print(String2Long('-3'))
Result
================String2Long(value) Wrong====================
(False, '')
(False, '3.0')
================String2Long(value) Correct====================
(True, 3L)
(True, -3L)
Synopsis
Sequence2Tuple(value)
Note
The conversion rule of this interface is the same as that of Python. If the value is not a sequence,
the conversion fails.
Description
Parameter Description
Return Value
The function returns a binary tuple.
l The value of the first element in the tuple is Boolean. True indicates that the type conversion
succeeds. False indicates that the type conversion fails.
l The value of the second element is the tuple after conversion.
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
Print("================Sequence2Tuple(value) Wrong====================")
Print(Sequence2Tuple(123))
Print("================Sequence2Tuple(value) Correct====================")
Print(Sequence2Tuple("abc"))
Print(Sequence2Tuple([1,2,3]))
Result
================Sequence2Tuple(value) Wrong====================
(False, 123)
================Sequence2Tuple(value) Correct====================
(True, ('a', 'b', 'c'))
(True, (1, 2, 3))
Synopsis
Sequence2List(value)
Note
The conversion rule of this interface is the same as that of Python. If the value is not a sequence,
the conversion fails.
Description
Parameter Description
Return Value
The function returns a binary tuple.
l The value of the first element in the tuple is Boolean. True indicates that the type conversion
succeeds. False indicates that the type conversion fails.
l The value of the second element is the list after conversion.
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
Print("================Sequence2List(value) Wrong====================")
Print(Sequence2List(123))
Print("================Sequence2List(value) Correct====================")
Print(Sequence2List('abc'))
Print(Sequence2List((1,2,3)))
Result
================Sequence2List(value) Wrong====================
(False, 123)
================Sequence2List(value) Correct====================
(True, ['a', 'b', 'c'])
(True, [1, 2, 3])
Synopsis
ToString(value)
Note
The conversion rule of this interface is the same as that of Python.
Description
Parameter Description
Return Value
The function returns a binary tuple.
l The value of the first element in the tuple is Boolean. True indicates that the type conversion
succeeds. False indicates that the type conversion fails.
l The second element is the string after conversion.
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
Print("================ToString(value)====================")
a=[1]
b={"b":2}
c=(a,b,3)
Print(ToString(a))
Print(ToString(b))
Print(ToString(c))
Print(ToString(None))
Result
================ToString(value)====================
(True, '[1]')
(True, "{'b': 2}")
(True, "([1], {'b': 2}, 3)")
(True, 'None')
Through the time function, you can obtain the Greenwich Mean Time (GMT) time and local
time. Also, you can convert the format of the obtained time.
Function Description
5.8.4 Function: GMTime This function is used to return the GMT time
according to the difference of the GMT time
and the epoch time.
5.8.5 Function: LocalTime This function is used to return the local time
according to the difference (second) of the
local time and the epoch time.
Function Description
5.8.9 Function: StrpTime This function is used to convert the time string
in a specified format into the time tuple.
5.8.10 Function: Time This function is used to obtain the GMT time
and converts it into the difference (second) of
the epoch time (1970/01/01 00:00:00) and the
current GMT time.
5.8.11 Function: CTime This function is used to obtain the local time
string.
Time Format
Format Description
Week number of the year (Sunday as the first day of the week) as a decimal
%U number [00, 53]. All days in a new year preceding the first Sunday are
considered to be in week 0.
Format Description
Week number of the year (Monday as the first day of the week) as a decimal
%W number [00, 53]. All days in a new year preceding the first Monday are
considered to be in week 0.
Tuple Elements
No. Element Value Range Description
Second as a numerical
5 Second 0-59
value
Weekday as a numerical
6 Week 0-6
value (0 indicates Monday)
Synopsis
GMTime([Secs])
Note
None.
Parameter Description
Parameter Name Description
Return Value
The return value is a tuple, which contains year, month, date, hour, minute, second, week, day,
and DST. For details about the structure of a tuple, see Time Tuple.
Error Handling
None.
Example
#Get and print the current GMT time. Convert 30 into a GMT time.
Print(GMTime()) # The current time in GMT format.
Print(GMTime(30)) # The time 30 seconds in GMT format.
Result
(2006, 10, 12, 6, 16, 55, 3, 285, 0)
(1970, 1, 1, 0, 0, 30, 3, 1, 0)
Synopsis
LocalTime([Secs])
Note
None.
Parameter Description
Parameter Name Description
Secs is a floating number with the unit expressed in second. The time
Secs starts from 1970/01/01 00:00:00.
The default of Secs is the return value of invoking the Time function.
Return Value
A tuple, which contains year, month, date, hour, minute, second, week, day, and DST, is returned.
Error Handling
None.
Example
(year,month,day) = LocalTime()[0:3] #Get the local time and the values of year, month, and date
Print("%d/%d/%d"%(day,month,year))
Result
13/10/2006
Synopsis
MkTime([t])
Note
None.
Parameter Description
Parameter
Description
Name
Return Value
A floating number with the unit expressed in second. The time starts from 1970/01/01 00:00:00.
Error Handling
None.
Example
Print(MkTime(GMTime())) #According to the GMT time, obtain the difference (in second) between
Print(MkTime(LocalTime())) #According to the local time, obtain the difference (in second) betw
Result
1210213390.0
1210184590.0
Synopsis
Sleep(Secs)
Note
None.
Parameter Description
Parameter Name Description
Secs The Secs parameter is of the numeric type. It indicates the paused
time. The unit is expressed in second.
Secs can be a decimal.
Return Value
None.
Error Handling
None.
Example
t1 = CTime()
Print('Sleep begins:%s'%t1)
Sleep(10)
t2 = CTime()
Print('Sleep ends:%s'%t2)
Result
Sleep begins:Tue Jan 08 09:33:55 2008
Sleep ends:Tue Jan 08 09:34:05 2008
Synopsis
StrfTime(format[,t])
Note
None.
Parameter Description
Parameter Description
Name
format It is used to define the time format. For details, see the Time Format
function.
Return Value
The formatted time string is returned.
Error Handling
None.
Example
Print(StrfTime("%a, %d %b %Y %H:%M:%S +0000", GMTime()))
Result
Fri, 13 Oct 2006 09:52:24 +0000
Synopsis
StrpTime(string,format=None)
Note
None
Parameter Description
Parameter Description
It is used to define the time format. For details, see the 5.8.2 Time
format
Format.
Return Value
In case of success, return the time tuple. Otherwise, the exception information is displayed.
Error Handling
None
Example
time= LocalTime()
Print(time)
stringtype = StrfTime("%a %d %b %Y %H:%M:%S +0000",time)
Print(stringtype)
tupletype = StrpTime(stringtype,"%a %d %b %Y %H:%M:%S +0000")
Print(tupletype)
Result
(2008, 1, 7, 15, 6, 51, 0, 7, 0)
Mon 07 Jan 2008 15:06:51 +0000
(2008, 1, 7, 15, 6, 51, 0, 7, -1)
Synopsis
Time()
Note
None
Parameter Description
None.
Return Value
The time difference of a floating number is returned.
Error Handling
None.
Example
#Get the GMT time.
secs = Time()
Print("---------------------------------")
#Add 3600 S, that is, one hour, to secs. Then, output the hour, minute, and second of the result.
Print(StrfTime("%H:%M:%S", GMTime(secs + 3600) ))
Result
The numeric representation of the GMT time: 1160821557.89S
The tuple representation of the GMT time: (2006, 10, 14, 10, 25, 57, 5, 287, 0)
---------------------------------
10:25:57
11:25:57
Synopsis
CTime()
Note
None.
Parameter Description
None.
Return Value
A string is returned, representing the local time. The format is Week Month Date Hour: Minute:
Second Year.
Error Handling
None.
Example
#Return and print the string of the local time.
Print(CTime())
Result
Mon Sep 11 14:51:15 2006
Synopsis
AscTime([t])
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is a string in the format of Week Month Day Hour: Minute: Second Year.
Error Handling
None.
Example
t = AscTime()
Print(t)
t = AscTime(GMTime())
Print(t)
t = AscTime(LocalTime())
Print(t)
Result
Tue Nov 07 21:14:26 2006
Tue Nov 07 13:14:26 2006
Tue Nov 07 21:14:26 2006
The output functions allow you to output the running information of the task to the interface or
a specified file in the set output mode. The input functions allow you to input the information
required when the task is running.
Table 5-18 lists the input and output functions provided by the iSStar.
Function Description
5.9.4 Function: SetOutMode This function is used to set the output mode
of the Print function.
5.9.5 Function: SetOutFlag This function is used to set the output switch
of the Print function.
5.9.6 Function: SetOutFileName This function is used to set the output file of
the Print function.
Synopsis
UserInput(EventPropmt[, EventType[, Items]]), InputText(EventPropmt[, EventType[, Items]])
Note
The function UserInput() is equivalent to InputText().
Parameter Description
Parameter Description
Return Value
The string entered from the client is returned.
Error Handling
If an error occurs, you can obtain the error information through 5.10.2 Function:
GetLastError and 5.10.2 Function: GetLastError.
Example
Msg = UserInput('input: ', 1) # Assume the user type Hello
Print('UserInput() return: ' + Msg)
Msg = UserInput('input: ', 2) # Assume the user type World
Print('UserInput() return: ' + Msg)
Msg = UserInput('input item from ABCD:',1,'ABCD') # Assume the user type A
Print('UserInput() return: ' + Msg)
Result
UserInput() return: Hello
UserInput() return: World
UserInput() return: A
Synopsis
UserOutput(EventPropmt[, EventType]),OutputText(EventPropmt[, EventType])
Note
The function UserOutput() is equivalent to OutputText().
Parameter Description
Parameter Description
Name
EventPropmt EventPropmt is a string. It is the message entered by the user on the client.
Return Value
None.
Error Handling
None.
Example
UserOutput("This is a test text of UserOutput function.") #Output the test infomation: This is
Result
This is a test text of UserOutput function.
Synopsis
SetOutMode(Mode)
Note
None.
Parameter Description
Parameter Description
Mode Mode is a string. It indicates the output mode. The value of the
output modes is as follows:
l 'gui': outputs to GUI
l 'file': Outputs to file
NOTE
Before the function is invoked, the default output mode is gui.
Return Value
If the output mode is set successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through GetLastError and
GetErrorMsg functions.
Example
SetOutMode('gui') # Set the output mode to GUI
Result
Hello!
(The string "Hello world!" is saved in the file E:\sample.txt.)
Synopsis
SetOutFlag(Flag)
Note
By default, the output switch is enabled.
Parameter Description
Parameter Description
Flag Set whether the Print function outputs the information. Flag is of any
types, including boolean, number, string, dictionary, list, and tuple.
The values indicating that the Print function does not output any
information are as follows:
l FALSE
l 0.0
l 0
l []
l ()
l {}
l None
l ""
l ''
Other values indicate that the Print function can output the information.
The default value is True, and it allows the Print function to output the
information.
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through the GetLastError and
GetErrorMsg functions.
Example
SetOutFlag(False) # Set output to false
Print("Hello world!") # The strings cannot be printed on the GUI
SetOutFlag(True) # Set output to true
Print("Hello!") # The string can be printed on the GUI
Result
Hello!
Synopsis
SetOutFileName(FileName)
Note
l If the output file is not set, the output mode contains the file mode. The default output file
is used.
l The default output file is installation path\script\output\system-generated result folder
\OutputFile.txt. The rule for naming the system-generated result folder is 'script operating
time in YYYYMMDDHHMMSS format'-'script name'. For example, the name of a result
folder can be D:\Client\script\output\061230230059-checklink\OutputFile.txt.
Parameter Description
Parameter Description
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through 5.10.2 Function:
GetLastError and 5.10.2 Function: GetLastError.
Example
Print("Hello world") # Print the string on the GUI
SetOutMode("file") # Set the output mode to file
SetOutFileName("D:\\sample.txt") # Set the name of the output file
Print("Hello!") # Print the string on the GUI and to the file sample.txt in D:\
Result
After the programming is complete, the string "Hello!" is appended to the file sample.txt in D:
\. On the GUI:
Hello world
Synopsis
Print(Msg)
Note
None.
Parameter Description
Parameter Description
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through the GetLastError and
GetErrorMsg functions.
Example
Print("Hello world!") # Print to the GUI
Result
Hello world!
Synopsis
GetOutputPath()
Note
None.
Parameter Description
None.
Return Value
The return value is the default output file path of string type.
Error Handling
If an error occurs, you can obtain the error information through GetLastError and
GetErrorMsg functions.
Example
# Obtain the default output path
returncode = GetOutputPath()
Print('GetOutputPath() return: ' + returncode)
Result
GetOutputPath() return: C:\Client\script\output\061028093234-sample
Synopsis
NotifyProgress(Progress, Description)
Note
If you call this function multiple times during the execution of a task, the currently displayed
result covers the former one.
Parameter Description
Parameter Description
Return Value
None
Error Handling
None
Example
# Pause for 10 seconds.
Sleep(10)
# Call the progress notifying function to display the task progress.
NotifyProgress(20, "sample Sleep 1.")
Sleep(10)
NotifyProgress(40, "sample Sleep 2.")
Sleep(10)
NotifyProgress(60, "sample Sleep 3.")
Sleep(10)
NotifyProgress(80, "sample Sleep 4.")
Sleep(10)
NotifyProgress(99, "sample Sleep 5.")
For the error occurred in the process of calling the HFC library function, the corresponding error
code is set to indicate the causes. You can obtain the error code of the current error through the
5.10.2 Function: GetLastError function in the GetError function, and then parse the error code
through 5.10.3 Function: GetErrorMsg to find out the error cause.
The GetError function allows you to obtain only the error code of the last error occurred in the
current task, and only one error code can be obtained at one time.
The GetError functions provided by the iSStar are listed in Table 5-19.
Function Description
5.10.2 Function: GetLastError This function enables you to obtain the last
error information of the current task.
5.10.3 Function: GetErrorMsg This function enables you to obtain the cause
according to the error code.
Synopsis
GetLastError()
Note
None.
Parameter Description
None.
Return Value
The tuple (errID, errInfo, trace_back) is returned. The meanings of the three elements in the
tuple are as follows:
l errID is the error code in integer type. The initial value is 0.
l errInfo is the error description in string type. By default, it is a null string ''. You need to
obtain the information through the GetErrorMsg function.
l trace_back is a tuple containing three elements: filename, lineno, and func_name.
– filename is a string. It indicates the current file path. If no error occurs in the current
file, the value is '<string>' .
– lineno is an integer. It indicates the line number of the error. The initial value is 0.
– func_name is a string. It indicates the name of the error function. The initial value is '?'.
Error Handling
None.
Related Examples
Synopsis
GetErrorMsg(errID)
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is a string. If the operation is successful, the error information is returned. If
the operation fails, the Unknown inner error string is returned.
Error Handling
None.
Related Examples
Example
Print("No Error Occurred")
errorlist = GetLastError() # Get the error code
Print("")
Print("One Error Occurred")
Result
No Error Occurred
errorlist: (0, '', ('<string>',0,'?'))
error message: ErrorCode:0x0
ErrorLevel:0
ModuleID:0
ErrorDescription:Request has been successfully executed.
5.11.2 Function: SetPassive Set the transmission mode for the FTP server.
5.11.4 Function: Upload Upload the source file to the specified FTP
server.
NOTE
You must connect to the server before uploading files, downloading files, or running commands remotely.
Through the FTP functions or the telnet functions, you can create only one connection for each task at a
time. If you create another connection, the previous connection is closed.
The procedure for uploading files through the FTP functions is as follows. For the instances, see
5.11.12 Example of Network Operation Function.
1. Obtain the IP address of the FTP server, the login user name and the password.
2. Upload files to the destination folder of the FTP server.
3. Log in to and connect to the FTP server. For details, see 5.11.3 Function: LoginFTP.
4. Upload files to a specified folder on the FTP server. For details, see 5.11.4 Function:
Upload.
5. Log out of the FTP server. For details, see 5.11.7 Function: LogoutFTP.
The procedure for downloading files through the FTP functions is as follows. For the examples,
see 5.11.12 Example of Network Operation Function.
1. Obtain the IP address of the FTP server, the login user name, and the password.
2. Obtain the folder that contains the files to be downloaded.
3. Log in to and connect to the FTP server. For details, see 5.11.3 Function: LoginFTP.
4. Download files from the FTP server to the local PC. For details, see 5.11.5 Function:
Download.
5. Log out of the FTP server. For details, see 5.11.7 Function: LogoutFTP.
The procedure for running the command through the Telnet functions is as follows. For the
instances, see 5.11.12 Example of Network Operation Function.
1. Obtain the IP address and port number of the telnet server.
2. Log in to and connect to the telnet server. For details, see 5.11.8 OpenTelnet Function.
3. Run commands through the telnet. For details, see 5.11.9 ExecuteCmd Function.
4. Disconnect from the telnet. For details, see 5.11.11 CloseTelnet Function.
Synopsis
SetPassive([mode])
Note
None.
Parameter Description
Parameter Description
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
None.
Synopsis
LoginFTP(Host, UserName, Password)
Note
l You need to call this function before performing other FTP operations.
l Only one FTP connection is allowed for the same task at the same time. If the FTP login
interface is used again, the established FTP connection is closed and then you need to
establish a new FTP connection.
Parameter Description
Parameter Description
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through GetLastError and
GetErroMsg functions.
Related Examples
Synopsis
Upload(SrcFile, TargetFile)
Note
l You need to call the LoginFTP function to connect to the server before calling this function.
l The source file path and target file path must exist. Otherwise uploading fails.
l If a file with the name of the uploaded one exists in the target file path, overwrite the file.
l You need to upload the file in a binary mode.
Parameter Description
Parameter Description
Name
TargetFile TargetFile is a string. It indicates the target file which the uploaded file
is saved. It supports Windows-style file path (containing \\) and Unix-
style file path (containing /).
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through GetLastError and
GetErrorMsg functions.
Related Examples
Synopsis
Download(SrcFile, TargetFile)
Note
l You need to call the LoginFTP function to connect to the server before calling this function.
l The source file path and target file path must exist. Otherwise downloading fails.
l If a file with the name of the downloaded one exists in the target file path, overwrite the
file.
l You need to download the file in a binary mode.
Parameter Description
Parameter Name Description
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through GetLastError and
GetErrorMsg functions.
Related Examples
Synopsis
GetFTPStatus()
Note
None.
Parameter Description
None.
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through GetLastError and
GetErrorMsg functions.
Related Examples
Synopsis
LogoutFTP()
Note
l After the operation of the FTP is complete, you must call this function to ensure that the
existing FTP connection is disconnected.
l When the established FTP connection is disconnected, this function can still return success
if you call this function again. It indicates that this function can be continuously called for
many times.
Parameter Description
None.
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
If an error occurs, you can obtain the error information through GetLastError and
GetErrorMsg functions.
Related Examples
Synopsis
OpenTelnet(strHostIp, port = 23)
Important
None.
Parameter Description
Parameter Parameter Description
Name
strHostIp strHostIp is of the string type. It indicates the IP address of the remote PC
to which you want to log in.
port port is of the integer type. It indicates the port number of the remote PC to
which you want to log in. By default, this parameter is set to 23.
Return Value
The return value is an object. If the function calling succeeds, the telnet object is returned.
Otherwise, "None" is returned.
Error Handling
None.
Example
tel = OpenTelnet('10.121.71.188')
CloseTelnet(tel)
Synopsis
ExecuteCmd (telnet, strCmd, [timeout])
Important
None.
Parameter Description
Parameter Description
Name
telnet telnet is of the object type, which identifies a telnet object. It is the return
value of 5.11.8 OpenTelnet Function.
timeout Timeout
is of the integer type. It indicates the timeout value of a command. By
default, the timeout value is 60 seconds.
Return Value
If the function is called successfully, 1 is returned. Otherwise, 0 is returned.
Error Handling
None.
Example
telrnc = OpenTelnet('10.161.196.246',6000)
rernc = ExecuteCmd(telrnc, 'LGI:op="lmtlmtlmt",pwd="lmtlmtlmt";',5)
CloseTelnet(telrnc)
Synopsis
IsConnected (telnet)
Important
None.
Parameter Description
Parameter Description
Name
telnet telnet is of the object type, which identifies a telnet object. It is the return
value of 5.11.8 OpenTelnet Function.
Return Value
If the function calling succeeds, 1 is returned. Otherwise, 0 is returned.
Error Handling
None.
Example
tel = OpenTelnet('10.121.71.188')
Print(IsConnected(tel))
CloseTelnet(tel)
Synopsis
CloseTelnet (telnet)
Important
None.
Parameter Description
Parameter Parameter Description
Name
telnet telnet is of the object type, which identifies a telnet object. It is the return
value of 5.11.8 OpenTelnet Function.
Return Value
None.
Error Handling
None.
Example
tel = OpenTelnet('10.121.71.188')
CloseTelnet(tel)
Example
#Upload the local file ftpsample.txt in D:\ to the ftp server, and download the files on the serve
localFilePath = "d:\\ftpsample.txt"
serverFilePath = "/export/home/ftpsample.txt"
distFilePath = "d:\\ftpdownload.txt"
Print("download failed!")
Print(GetLastError())
end
end
if not LoginFTP(serverIp,userName,password)
# if fail in login, print information
Print("login error!")
else
uploadFileToServer()
downloadFileFromServer()
LogoutFTP()
end
Result
Please input ip address of ftpserver:
>>>10.161.213.188
Please input user name:
>>>root
Input your password:
>>>******
upload finished!
download finished!
# connect an NE
telrnc = OpenTelnet('10.161.196.246',6000)
#login
rernc = ExecuteCmd(telrnc, 'LGI:op="lmtlmtlmt",pwd="lmtlmtlmt";',5)
Print(rernc)
# execute MML command
rernc = ExecuteCmd(telrnc, 'LST OP:;',5)
Print(rernc)
CloseTelnet(telrnc)
++++++++++++++++++++++++++++++++++++++++++++++++++++
--- END
--- END
This gives the examples of the report operation function. You can better understand how to use
report operation functions to perform routine maintenance.
The report operation functions provided by the iSStar enable you to easily create a professional
report. You can write the required information to the custom report to facilitate future query. By
using the report operation functions, you can perform the related operations, for example, you
can set the display contents of a range, customize the display mode of a report, such as the
background color and alignment mode of a table, range, or cell.
Function Description
Function Description
5.12.6 Examples of Report Operation Function shows the examples. The procedure of report
operations is as follows:
1. Create a report object.
2. Create a sheet.
3. Create a table.
4. Set the cell data and format.
5. Save the report.
Function: AddRange
This describes the AddRange function. This function enables you to create a range in the
specified table.
Synopsis
AddRange(TableHandle, RowFrom, ColFrom, RowTo, ColTo[, bMerged])
Note
l The range cannot overlap or include each other.
l When creating a range, you can specify whether to merge the cells in the range. After the
cells are merged, all the operations related to the cells are invalid. You can only operate
the whole range.
l Before calling this function, call Function: NewReport to create a report object, call
Function: AddSheet to create a sheet, and call Function: AddTable to create a table.
Parameter Description
Parameter Description
RowFrom RowFrom is an integer. It indicates the start row number of the range
in the table.
Row number begins from 0.
RowTo RowTo is an integer. It indicates the end row number of the range
in the table.
ColTo ColTo is an integer. It indicates the end column number of the range
in the table.
Return Value
The return value is an integer. If the range is created successfully, the range Handle (the unique
identifier of the range) is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
#Create a report object.
NewReport()
#Add a table with six rows and eight columns. The title is table1.
table1 = AddTable(page1, 6, 8, "table1",)
#Specifiy a range in the table. The range is from row 1 to row 3 and column 2 to column 5. Note tha
range1 = AddRange(table1, 1, 2, 3, 5, 1)
Function: AddSheet
This describes the AddSheet function. This function enables you to add a sheet to the specified
report.
Synopsis
AddSheet(SheetName)
Note
l The total number of rows in the pages is 65535, and total number of columns is 255.
l SheetName cannot be null, and the length of the character string cannot be more than 31
characters. The symbols :?\./*[] are not allowed in the sheet name.
l SheetName must be unique. If the new sheet name exists in the report, the invalid handle
number 0 is returned after you call the AddSheet function.
l Before the function is called, call Function: NewReport to create a report.
Parameter Description
Parameter Description
SheetName SheetName is a character string. It indicates the sheet name. The sheet
name must be unique.
Return Value
l The return value is an integer.
l If the function is executed successfully, the Handle, that is, the unique identifier of the
sheet, is returned. If the execution fails, 0 is returned.
l If the new sheet name exists in the report, the sheet cannot be created and 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
#Create a report object.
NewReport()
#Add a sheet named page one.
Function: AddTable
This describes the AddTable function. This function enables you to add a table to the specified
page.
Synopsis
AddTable(SheetHandle, Row, Col, TableName = "")
Note
l The title of the generated table occupies one row.
l If you add multiple tables to the same page, tables are separated by three blank rows.
l The maximum row number is 65530, and the maximum of total column number is 255.
l Before this function is called, you should call Function: NewReport to create a report and
call Function: AddSheet to create a sheet.
Parameter Description
Parameter Description
SheetHandle SheetHandle is a long integer. It indicates Handle of the page (the unique
mark of the page).
Return Value
The return value is an integer. If the function is called successfully, the table Handle (the unique
mark of the table) is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
#Create a report object.
NewReport()
#Add a table with six rows and eight columns. The title is table.
table1 = AddTable(page1, 6, 8, "table1")
Function: GetRowCount
This describes the GetRowCount function. This function enables you to obtain the number of
rows in the specified table.
Synopsis
GetRowCount(SheetName,TableNo)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If this function is called successfully, the number of rows in the
table is returned. Otherwise, 0 is returned.
Error Handling
None
Example
NewReport()
page1 = AddSheet("sheet1")
table1 = AddTable(page1, 6, 8, "table1")
#Get the number of rows in the specified table on the specified page.
count = GetRowCount("sheet1", 0)
Print(count)
SaveReportAs("result.xls")
Result
6
Related Example
Function: GetRowData
This describes the GetRowData function. This function enables you to obtain the data of a row
in a table.
Synopsis
GetRowData(SheetName,TableNo,RowNo)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is a string list. If this function is successfully called, the contents of the obtained
row is returned. Otherwise, an empty list is returned.
Error Handling
None
Example
sheetName = "sheet1"
tableNo = 0
datalist = ["data0", "data1", "data2", "data3"]
NewReport()
page1 = AddSheet(sheetName)
table1 = AddTable(page1, 6, 4, "table1")
SaveReportAs("result.xls")
Result
['', '', '', '']
['data0', 'data1', 'data2', 'data3']
Related Example
Function: InsertRow
This describes the InsertRow function. This function enables you to insert a row in the specified
table according to the row number.
Synopsis
InsertRow(SheetName,TableNo,RowNo,DataList)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If this function is successfully called, 1 is returned. Otherwise, 0
is returned.
Error Handling
None
Example
sheetName = "sheet1"
tableNo = 0
rowNo = -1
datalist = ["data0", "data1", "data2", "data3"]
NewReport()
page1 = AddSheet("sheet1")
table1 = AddTable(page1, 6, 4, "table1")
SaveReportAs("result.xls")
Related Example
Function: RemoveRow
This describes the RemoveRow function, which enables you to remove a row.
Synopsis
RemoveRow(SheetName, TableNo, RowNo = -1)
Note
None
Parameter Description
Parameter Parameter Description
Return Value
The return value is an integer. If row number is modified successfully called, 1 is returned.
Otherwise, 0 is returned.
Error Handling
None
Example
NewReport()
page1 = AddSheet("sheet1")
table1 = AddTable(page1, 6, 8, "table1")
valueList = [str(i) for i in range(6 * 8)]
SetTableValue(table1, valueList)
SaveReportAs("result.xls")
Related Example
Function: Selector
This describes the Selector function. The display style of cells refers to the background color,
alignment mode, and font.
Synopsis
Selector(Exp,Default,Mode)
Note
You need to ensure that the condition logic of the expression is rational. A self-contradictory
condition causes the failure to execute the expression.
Parameter Description
Parameter Description
Parameter Description
$1:$2 == 'Error' and $2:$1 == 'Unavailable' Indicates that in a data aggregate, the
condition is met if the data in row 1 column
2 is error and the data in row 2 column 1 is
unavailable. The data aggregate of row 1
column 2 and row 2 column 1 is returned.
NOTE
The configuration mode of this type of expression
can only be CELL_MODE. Other configuration
modes are not applicable.
:$1 > 50 and :$1 <= 75 Indicates that in a data aggregate, the
condition is met if the data values in column
1 are greater than 50 and equal to or smaller
than 75. Then the data aggregate that meets
the condition is returned.
NOTE
l For a combined condition, the keywords must
refer to the same range. A condition like :$1 >
50 and :$2 <= 75, where the first keyword refers
to column 1 and the second column 2, is invalid.
l For a combined condition, the expressions must
not contradict each other. That is, the
expression type must be the same, for example,
all the expressions are led by $, :$, or $X:$Y.
$1 > 50 and :$2 <= 75 is an invalid expression.
Return Value
The return value is the handle to the expression object. If this function is successfully called, a
non-null handle is returned. Otherwise, None is returned.
Error Handling
None.
Example
style = ReportStyle(Light_Orange, 'C')
exp1 = Selector(':$1 > 50 and :$1 <= 75', style, ROW_MODE)
Related Example
Function: SetCellValue
This describes the SetCellValue function. This function enables you to set the values of the
specified cell.
Synopsis
SetCellValue(TableHandle, Row, Col, Value)
Note
Before calling this function, call Function: NewReport to create a report object, call Function:
AddSheet to create a sheet, and call Function: AddTable to create a table.
Parameter Description
Parameter Parameter Description
Row Row is an integer. It indicates the row position. Row number begins
from 0.
Return Value
The return value is an integer. If the contents of the specified cell is set successfully, 1 is returned.
Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
SaveReportAs("example.xls")
Related Example
Function: SetRangeValue
This describes the SetRangeValue function. This function enables you to set the value of the
specified range.
Synopsis
SetRangeValue(RangeHandle, Value)
Note
l Before this function is called, you should call Function: NewReport to create a report,
call Function: AddSheet to add a sheet, call Function: AddTable to add a table, and
call Function: AddRange to get a range.
l If the cells are set to merge when you create the range, this function sets the display contents
of the merged range.
l If the cells are not set to merger when you create the range, this function sets the display
contents of each cell in the range.
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the contents of the specified range is set successfully, 1 is
returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
range1 = AddRange(table1, 1, 2, 3, 5, 1)
SaveReportAs("D:/example05.xls")
Related Example
Function: SetTableValueEx
This describes the SetTableValueEx function. This function enables you to add data to a table
and set the display style of the placement specified by the conditional expression.
Synopsis
SetTableValueEx(TableHandle,TbData[,Exps])
Note
l Before calling the SetTableValueEx function, you need to call the NewReport function.
l This function supports a maximum of 10 conditional expressions. Only the first 10
conditional expressions can be set successfully if more than 10 expressions are created.
l When the function is called, the rows or columns that are beyond the settings of TbData
are truncated.
Parameter Description
Parameter Description
Exps Exps is a conditional express list. Each element in the list is the
conditional expression object of the Selector function.
Return Value
The return value is an integer. If the data is successfully added to the table, 1 is returned.
Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
#Create a two-dimensional list.
data = [['Name', 'English', 'Maths', 'History', 'Chinese']]
data.append(['Jacky', 65, 79, 56, 85])
data.append(['Tommy', 85, 70, 87, 90])
data.append(['Marry', 46, 56, 59, 85])
data.append(['Rob', 85, 80, 87, 74])
data.append(['Jenny', 90, 75, 67, 65])
NewReport()
sId = AddSheet('school report card')
tId = AddTable(sId, len(data), len(data[0]))
rId = AddRange(tId, 0, 0, 0, len(data[0])-1 )
SetRangeBGColor(rId, Teal)
#Set the condition expression. If the score is lower than 60, the background color is red.
ex1 = Selector('$$ < 60', style1)
#Put the data in the table. Fill in the style through the condition expression.
SetTableValueEx(tId, data, [ex1])
SaveReportAs('report.xls')
Result
A file report.xls is created,As follows
Related Example
Function: SetTableValue
This describes the SetTableValue function. This function enables you to set the contents of the
cells in a table.
Synopsis
SetTableValue(TableHandle, ValueList)
Note
l For a table with m rows and n columns, set contents of the cells in the sequence of (0,0),
(0, 1)...(0,n),(1,0),(1,1)...(1,n),(m,0),(m,1)...(m,n).
l If a cell is actually a range merged by multiple cells, set the range value to the value of the
first cell in the range.
l Before calling this function, call Function: NewReport to create a report object, call
Function: AddSheet to create a sheet, and call Function: AddTable to create a table.
Parameter Description
Parameter Description
TableHandle TableHandle is a long integer. It indicates the return value of the Function:
AddTable function.
ValueList ValueList is of list type. The elements in the list are strings which indicate
the values of the cells in the table.
Return Value
The return value is an integer. If the contents of the cells in the table is set successfully, 1 is
returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
valueList = [str(i) for i in range(6 * 8)]
SaveReportAs("D:/example.xls")
Related Example
Function: UpdateRow
This describes the UpdateRow function. This function enables you to update the contents of a
row in the specified table.
Synopsis
UpdateRow(SheetName, TableNo,RowNo,DataList)
Note
None
Parameter Description
Parameter Parameter Description
Return Value
The return value is an integer. If the data in the specified row is modified successfully, 1 is
returned. Otherwise, 0 is returned.
Error Handling
None
Example
NewReport()
page1 = AddSheet("sheet1")
table1 = AddTable(page1, 6, 8, "table1")
valueList = [str(i) for i in range(6 * 8)]
SetTableValue(table1, valueList)
ret = UpdateRow("sheet1", 0, 1, ["Happy ","new ","year ! "])
SaveReportAs("result.xls")
Related Example
Function: ReportStyle
Sets the cell display style. The display style of cells refers to the background color, alignment
mode, and font.
Synopsis
ReportStyle([BgColor[,Align[,Font]]])
Note
l All input parameters of this function have default values. If you do not specify the input
parameters, the default display style is white background and centered.
l Before calling the ReportStyle function, you need to call the NewReport function.
Parameter Description
Parameter Description
Parameter Description
Font Font is of tuple type. It contains four elements, that is, type, size,
color, and bold.
l Type is an integer. It indicates the font type. The optional value
ranges from 0 to 8.
For details of the meanings of type, refer to Parameter:
FontType.
l Size is an integer. It indicates the font size. The value ranges from
7 to 36 pounds.
l Color is an integer. It indicates the background color. The value
ranges from 0 to 39.
To know the meaning of color, refer to Parameter: Color.
l Bold is an integer. It indicates whether fonts are in bold.
– The value 1 means that the fonts are in bold.
– The value 0 means that the fonts are displayed in normal
conditions.
Return Value
The return value is an integer. If the display style of cells is created, a value greater than 0 is
returned. Otherwise, -1 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
style = ReportStyle(Light_Orange, 'C')
exp1 = Selector(':$1 > 50 and :$1 <= 75', style, ROW_MODE)
Related Example
Function: SetCellAlign
This describes the SetCellAlign function. This function enables you to set the alignment type of
a cell.
Synopsis
SetCellAlign(TableHandle, Row, Col[, Type])
Note
Before this function is called, you should call Function: AddTable to create a table.
Parameter Description
Parameter Parameter Description
TableHandle TableHandle is a long integer. It indicates Handle of the table (the unique
identifier of the table).
Type Type is a character. It indicates the content align type within the range.
The optional values are as follows:
l L
l C
l R
l l
l c
l r
For detailed meanings of Type, refer to Parameter: Type.
The default value is L.
Return Value
The return value is an integer. If the alignment type of the cell is set successfully, 1 is returned.
Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
table1 = AddTable(page1, 6, 8)
valueList = [str(i) for i in range(6 * 8)]
SetTableValue(table1, valueList)
SaveReportAs("example.xls")
Result
A file example.xls is created
Related Example
Function: SetCellBGColor
This describes the SetCellBGColor function. This function enables you to set the background
color of a cell.
Synopsis
SetCellBGColor(TableHandle, Row, Col, Color)
Note
Before this function is called, you should call Function: AddTable to create a table.
Parameter Description
Parameter Parameter Description
TableHandle TableHandle is a long integer. It indicates Handle of the table (the unique
identifier of the table).
Color Color is an integer. It indicates the background color. The optional values
of Color range from 0 to 39.
To know the meaning of Color, refer to Parameter: Color.
Return Value
The return value is an integer. If the background color of the cell is set successfully, 1 is returned.
Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
table1 = AddTable(page1, 6, 8)
valueList = [str(i) for i in range(6 * 8)]
resultCode = SetTableValue(table1, valueList)
resultcode = SetCellBGColor(table1, 3, 3, Teal)
SaveReportAs("example.xls")
Related Example
Function: SetCellFont
This describes the SetCellFont function. This function enables you to set the font, size, color,
bold of a cell.
Synopsis
SetCellFont(TableHandle, Row, Col, FontType[, FontSize[,Color[, bBold]]])
Note
Before calling this function, call Function: NewReport to create a report object, call Function:
AddSheet to create a sheet, and call Function: AddTable to create a table.
Parameter Description
Parameter Parameter Description
TableHandle TableHandle is a long integer. It indicates Handle of the table (the unique
identifier of the table).
Row Row is an integer. It indicates the row position. Row number begins from
0.
Col Col is an integer. It indicates the column position. The column number
begins from 0.
FontType FontType is an integer. It indicates the font type. The optional value starts
from 0 to 8.
For detailed meanings of the values of FontType, refer to Parameter:
FontType.
FontSize FontSize is an integer. It indicates the font size. The value ranges from 7
to 36 pounds. The default value is 9 pounds.
Color Color is an integer. It indicates the background color. The optional values
range from 0 to 39. The default value is 0, which indicates black.
For details of the optional values for Color, refer to Parameter: Color.
Return Value
The return value is an integer. If the font the cell is set successfully, 1 is returned. Otherwise, 0
is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
table1 = AddTable(page1, 8, 10, "table1")
SetCellValue(table1, 6, 7, "cellvalue")
#Set the font of the cell in row 6 and column 7 in table1 to Arial, 10 pounds, and bold.
resultcode = SetCellFont(table1, 6, 7, 0, 10, 19, 1)
SaveReportAs("example.xls")
Related Example
Function: SetColumnWidth
This describes the SetColumnWidth function. This function enables you to set the width of the
specified column in a sheet.
Synopsis
SetColumnWidth(SheetHandle, Col[, Width])
Note
l The setting for column width of the page is only valid for files in .xls format.
l Before this function is called, you should call Function: NewReport to create a report and
call Function: AddSheet to create a sheet.
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the column width of the specified column is set successfully,
1 is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
for row in range(4)
ret = SetColumnWidth(page1, row, 2 )
end
SaveReportAs("example.xls")
Related Example
Function: SetRangeAlign
This describes the SetRangeAlign function. This function enables you to set the content
alignment type of the specified range.
Synopsis
SetRangeAlign(RangeHandle[, Type])
Note
l For a range whose cells are not set to merge when being created, this function sets the
alignment mode of all the cells in the range.
l Before this function is called, you should call Function: AddRange to create an area.
Parameter Description
Parameter Description
Type Type is a string. It indicates the content alignment type. The optional
values are as follows:
l L
l C
l R
l l
l c
l r
For detailed meanings of the values of Type, refer to Parameter:
Type.
The default value is L.
Return Value
The return value is an integer. If the alignment type of the specified range is set successfully, 1
is returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
table1 = AddTable(page1, 6, 8)
range1 = AddRange(table1, 1, 2, 3, 5, 1)
SetRangeValue(range1,'right')
resultcode = SetRangeAlign(range1, "R")
SaveReportAs("example.xls")
Related Example
Function: SetRangeBGColor
This describes the SetRangeBGColor. This function enables you to set the background color of
the specified range.
Synopsis
SetRangeBGColor(RangeHandle, Color)
Note
l For a range whose cells are not set to merge when being created, this function sets the
background color of all the cells in the range.
l Before this function is called, you should call Function: AddRange to create an area.
Parameter Description
Parameter Description
Color Color is an integer. It indicates the background color. Its value ranges
from 0 to 39.
For details of the optional values for Color, refer to Parameter:
Color.
Return Value
The return value is an integer. If the background color of the range is set successfully, 1 is
returned. Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
table1 = AddTable(page1, 6, 8)
range1 = AddRange(table1, 1, 2, 3, 5, 1)
resultcode = SetRangeBGColor(range1, Blue)
SaveReportAs("example.xls")
Related Example
Function: SetRangeFont
This describes the function SetRangeFont function. This function enables you to set the type,
size, color, bold of a range in a table.
Synopsis
SetRangeFont(RangeHandle, FontType[, FontSize[, Color[, bBold]]])
Note
l For the range whose cells are not set to merge when being created, this function sets the
font of all the cells in the range.
l Before this function is called, you should call Function: NewReport to create a report,
call Function: AddSheet to add a sheet, call Function: AddTable to add a table, and
call Function: AddRange to get a range.
Parameter Description
Parameter Parameter Description
FontType FontType is an integer. It indicates the font type. The optional value
starts from 0 to 8.
To know the meaning of FontType, refer to Parameter: FontType.
FontSize FontSize is an integer. It indicates the font size. The value ranges from
7 to 36 pounds.
The default value is 9 pounds by default.
Return Value
The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0
is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
table1 = AddTable(page1, 6, 8)
range1 = AddRange(table1, 1, 2, 3, 5, 1)
SetRangeValue(range1, "SetRangeFont")
#Set the font of the range to Arial, 9 pounds, red, and not bold.
resultcode = SetRangeFont(range1, 0, 9, 16, 0)
SaveReportAs("exa09.xls")
Related Example
Function: SetTableBGColor
This describes the SetTableBGColor. This function enables you to set the background color of
a table.
Synopsis
SetTableBGColor(TableHandle, Color)
Note
l This function re-defines the background color of the cells and ranges in the table.
l Before calling this function, call Function: NewReport to create a report object, call
Function: AddSheet to create a sheet, and call Function: AddTable to create a table.
Parameter Description
Parameter Description
Color Color is an integer. It indicates the background color. Its value ranges
from 0 to 39. The default value is 39, representing white.
For details of the optional values for Color, refer to Parameter:
Color.
Return Value
The return value is an integer. If the background color of the table is set successfully, 1 is returned.
Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
#Set the background color of the cell in row 3 and column 5 in table1 to yellow.
resultcode = SetCellBGColor(table1, 3, 5, 26)
SaveReportAs("example.xls")
Related Example
Function: SetTableFont
This describes the SetTableFont function. This function enables you to set the table font.
Synopsis
SetTableFont(TableHandle, FontType[, FontSize[, Color[, bBold]]])
Note
Before calling this function, call Function: NewReport to create a report object, call Function:
AddSheet to create a sheet, and call Function: AddTable to create a table.
Parameter Description
Parameter Description
FontType FontType is an integer. It indicates the font type. The optional value
ranges from 0 to 8.
For detailed meaning of the FontType parameter refer to Parameter:
FontType.
FontSize FontSize is an integer. It indicates the font size. The value ranges from
7 to 36 pounds.
The default value is 9 pounds by default.
Color Color is an integer. It indicates the background color. The values ranges
from 0 to 39. The default value is 0, which indicates black.
For detailed meaning of the Color parameter, refer to Parameter:
Color.
Return Value
The return value is an integer. If the font of the table is set successfully, 1 is returned. Otherwise,
0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
valueList = [str(i) for i in range(6 * 8)]
SetTableValue(table1, valueList)
SaveReportAs("example.xls")
Related Example
Function: SetTableTitleFont
This describes the SetTableTitleFont function. This function enables you to set the font, size,
color, and bold of the table title.
Synopsis
SetTableTitleFont(TableHandle, FontType[, FontSize[, FontColor[, bBold]]])
Note
Before calling this function, call Function: NewReport to create a report object, call Function:
AddSheet to create a sheet, and call Function: AddTable to create a table.
Parameter Description
Parameter Parameter Description
FontType FontType is an integer. It indicates the font type. The optional value
ranges from 0 to 8.
To know the meaning of FontType, refer to Parameter: FontType.
FontSize FontSize is an integer. It indicates the font size. The value ranges from
7 to 36 pounds.
The default value is 9 pounds by default.
Color Color is an integer. It indicates the background color. The value ranges
from 0 to 39. The default value is 0, which indicates black.
For detailed meaning of the Color parameter, refer to Parameter:
Color.
Return Value
The return value is an integer. If the font of the table title is set successfully, 1 is returned.
Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
#Set the font of the title of table1 to “Black”, 12 pounds, gray, and bold.
resultcode = SetTableTitleFont(table1, 4, 12, 15, 1)
SaveReportAs("exa08.xls")
Related Example
Function: LoadReport
This describes the LoadReport function. This function enables you to import the reports in the
specified path.
Synopsis
LoadReport(FilePath)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the report is imported successfully, the value 1 is returned.
Otherwise, 0 is returned.
Error Handling
None
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
valueList = [str(i) for i in range(6 * 8)]
SetTableValue(table1, valueList)
SaveReportAs("oldfile.xls")
StoreReport("c:/storefile.dat")
ret = LoadReport("c:/storefile.dat")
RemoveRow("Page1", 0, 0)
SaveReportAs("newfile.xls")
Related Example
Function: NewReport
This describes the NewReport function. This function enables you to create a report.
Synopsis
NewReport()
Note
l During the report operation, this function must be called before it is called by other report
operations.
l For one task, NewReport can be called only once. If the NewReport() interface is invoked
again, all the previous report operations are deleted.
Parameter Description
None
Return Value
The return value is an integer. If the report is created successfully, the value 1 is returned.
Otherwise, 0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
SaveReportAs("exa08.xls")
Related Example
Function: SaveReportAs
This describes the SaveReportAs function. This function enables you to save the created report
file.
Synopsis
SaveReportAs(FilePath)
Note
l The save path does not support the network path format.
l If the same file name exists in the specified directory, an extension .bak is added to the file
name, and then the system saves the created file.
l Before the function is called, call Function: NewReport to create a report.
Parameter Description
Parameter Description
FilePath FilePath is a character string. It indicates the file save path. It can support
Window style file path (containing //) and Unix style file path
(containing \). The file is in .xls, .html, or .htm format.
Return Value
The return value is an integer. If the report file is saved successfully, 1 is returned. Otherwise,
0 is returned.
Error Handling
Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3
Function: GetErrorMsg functions.
Example
NewReport()
page1 = AddSheet("page1")
SaveReportAs("exa08.xls")
SaveReportAs("exa08.html")
Result
A file exa08.xls is created
Related Example
Function: StoreReport
This describes the StoreReport function. This function enables you to export the report model
files. The report model file is a data file specially used to store the contents of a report. You can
export, import, or modify a report model file. A generated report file cannot be modified.
Through the iSStar, you can import a report model file and modify it. In this way, the existing
report files can be modified.
After a model file is imported, you can modify the objects such as sheet and table, and then save
the report by using Function: SaveReportAs. Figure 5-8 lists the operators.
Synopsis
StoreReport(filePath)
Note
None
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the report model file is exported successfully, a positive integer
is returned. Otherwise, 0 is returned.
Error Handling
None
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
valueList = [str(i) for i in range(6 * 8)]
SetTableValue(table1, valueList)
SaveReportAs("oldfile.xls")
StoreReport("c:/storefile.dat")
ret = LoadReport("c:/storefile.dat")
RemoveRow("Page1", 0, 0)
SaveReportAs("newfile.xls")
Related Example
Parameter: Color
This describes the Color values and their meanings related to report operations.
The optional value for Color ranges from 0 to 39, as shown in Figure 5-9. Table 5-26 describes
the meaning of each color.
Value Meaning
0 Black
1 Brown
2 Olive_Green
3 Dark_Green
4 Dark_Teal
5 Dark_Blue
6 Indigo
7 Gray80
8 Dark_Red
9 Orange
Value Meaning
10 Dark_Yellow
11 Green
12 Teal
13 Blue
14 Blue_Gray
15 Gray50
16 Red
17 Light_Orange
18 Lime
19 Sea_Grean
20 Aqua
21 Light_Blue
22 Violet
23 Gray40
24 Pink
25 Gold
26 Yellow
27 Bright_Green
28 Turquoise
29 Sky_Blue
30 Plum
31 Gray25
32 Rose
33 Tan
34 Light_Yellow
35 Light_Green
36 Light_Turquoise
37 Pale_Blue
38 Lavender
39 White
Parameter: FontType
This describes the values and meanings of the FontType parameter, which is associated with
report operations.
The value of FontType ranges from 0 to 8. Table 5-27 lists the meaning of each value.
NOTE
If the fonts are not defined, the default settings are as follows:
l Font: Arial
l Size: 9 pounds
l Color: Black
l Bold: No
0 Arial
1 Courier New
5 Century
6 MS Gothic
Parameter: Type
This describes the Type values and their meanings related to report operations.
To know the optional Type values and their meanings, refer to Table 5-28.
Format Meaning
Example
#create a report object
NewReport()
Call("cell_sample.hsl")
Call("color_sample.hsl")
Call("font_sample.hsl")
Call("Align_sample.hsl")
#save report
SaveReportAs("d:/reportSample.xls")
SaveReportAs("d:/reportSample.html")
cell_sample.hsl
#create new sheet named“color”
page = AddSheet("Edit Table")
table1 = AddTable(page, 6, 8, "Modify single cell")
table2 = AddTable(page, 6, 8, "Modify cells in range")
table3 = AddTable(page, 6, 8, "Fill table with list")
#########set a single cell's value######
SetCellValue(table1, 0, 0, "hello")
########set several at one time##########
rowFrom = 2
colFrom = 2
rowTo = 3
colTo = 3
range = AddRange(table2, rowFrom, colFrom, rowTo, colTo)
SetRangeValue(range, "hello")
#########fill table with list#################
valueList = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U
SetTableValue(table3, valueList)
# AddSheet(sheetname)
# AddTable(SheetHandle, row, col, tablename)
# SetCellValue(TableHandle, row, col, pszValue)
# SetRangeValue(RangeHandle, pszValue)
# SetTableValue(TableHandle, list)
color_sample.hsl
#create new sheet named“color”
page1 = AddSheet("color")
table1 = AddTable(page1, 6, 8, "color sample")
table2 = AddTable(page1, 25, 8, "Edit table color")
font_sample.hsl
#1 create new sheet named "font"
page = AddSheet("font")
#2 create a table
table = AddTable(page, 5, 6, "font")
#3 set table header
range1 = AddRange(table, 0, 0, 4, 5)
SetRangeValue(range1, "Hello world")
valueList = ['Font','Normal','Size 15','Size 25','Color','Bold']
SetTableValue(table, valueList)
SetCellValue(table, 1, 0, "Arial")
SetCellValue(table, 2, 0, "Courier New")
SetCellValue(table, 3, 0, "Century")
SetCellValue(table, 4, 0, "MS Gothic")
#4 basic font sample
defaultSize = 15
defaultColor = 0
red = 16
bold = 1
def setRowFont(row,font)
SetCellFont(table, row, 1, font)
Align_sample.hsl
#create new sheet named"Align"
page1 = AddSheet("Align")
#create a table named "Align_Sample"
table1 = AddTable(page1, 7, 6, "table1")
for row in range(1,7)
for col in range(6)
SetCellValue(table1, row, col ,"Hello")
end
end
#flush left
cellRow = 0
cellCol = 0
SetCellAlign(table1, cellRow, cellCol, 'L')
SetCellValue(table1, cellRow, cellCol, 'left')
#flush right
cellRow = 0
cellCol = 1
SetCellAlign(table1, cellRow, cellCol, 'R')
SetCellValue(table1, cellRow, cellCol, 'right')
#flush center
cellRow = 0
cellCol = 2
SetCellAlign(table1, cellRow, cellCol, 'C')
SetCellValue(table1, cellRow, cellCol, 'center')
#set align by range
range1 = AddRange(table1, 1, 0, 2, 5)
SetRangeAlign(range1, 'L')
SetRangeValue(range1, "left")
range2 = AddRange(table1, 3, 0, 4, 5)
SetRangeAlign(range2, 'R')
SetRangeValue(range2, "right")
range3 = AddRange(table1, 5, 0, 6, 5)
SetRangeAlign(range3, 'C')
SetRangeValue(range3, "center")
This function enables you to write the data into the opened file.
5.13.5 Function: close
This function enables you to close the opened file.
5.13.6 Function: FindFiles
This function returns the absolute path list for the files that meet the search conditions such as
Day.
5.13.7 Function: MkDir
This function enables you to create a directory. You must ensure that the parent directory exists.
5.13.8 Function: RmDir
This function enables you to delete the specified directory.
5.13.9 Function: GetCwd
This function is used to display the current working path.
5.13.10 Function: Remove
This function enables you to delete the specified file.
5.13.11 Function: Rename
This function enables you to change the name of a file or directory.
5.13.12 Function: ListDir
This function lists all the files in the specified folder.
5.13.13 Function: MakeDirs
This function enables you to create directories recursively, such as, creating all the intermediate-
level directories (including the lead directory).
5.13.14 Function: RemoveDirs
This function enables you to recursively remove the specified directories.
5.13.15 Examples of Directory Operation Function
This section describes how to use the directory operation function through the following
example.
The directory operation functions provided by the iSStar are listed in Table 5-29.
Function Description
5.13.2 Function: Open This function enables you to open the file in
a specified mode.
Function Description
5.13.3 Function: read This function enables you to read the data
from the opened file.
5.13.5 Function: close This function enables you to close the opened
file.
5.13.9 Function: GetCwd This function enables you to display get the
existing path.
5.13.11 Function: Rename This function enables you to change the name
of a file or directory.
5.13.12 Function: ListDir This function lists all the files in the specified
directory.
Synopsis
Open(filename[,mode])
Note
l When the file is opened in a 'w' or 'w+' mode, the original data in the file is overwritten
when you perform the write operation.
l When the file is opened in an 'a' or 'a+' mode, the content to be written is added to the end
of the file when you perform the write operation.
Parameter Description
Parameter
Description
Name
l If 'b' is appended to the mode, you can specify that the file is opened in binary mode.
l The 'r+', 'w+', and 'a+' modes support reading and writing operations, but they do
not support reading and writing operations at the same time.
l In the 'r+' mode, you can write the data at the beginning of the file. The content of
the file is overwritten partially. Therefore, illegible characters may occur after you
write the data into the file.
l In the 'w', 'a', 'w+', 'a+' mode, if the file to be opened does not exist, the file is created.
Return Value
In case of success, the file operation ID is returned. Otherwise, an exception occurs.
Error Handling
If the specified file does not exist when you open the file in a read mode, the program throws
an exception that the specified file does not exist.
Synopsis
File_object.read(size=MAXSIZE)
Note
l When using the Read function, you need to open the existing file in a read mode through
the Open function.
l If the length of the data needed to be read exceeds the maximum, you need to read all the
data of the file.
Parameter Description
Parameter
Description
Name
By default, the length of the data needed to be read is the maximum data
length of the file. The unit is byte, and the value range must be greater than
size 0.
If the data length needed to be obtained is not entered, all the data of the
file are read by default.
Return Value
The return value is the data read from the file.
Error Handling
None.
Example
fp = Open("d:\\Hello.txt",'r') #Assmue that the content of the Hello.txt file is 12345.
str = fp.read()
Print(str)
Results
12345
Synopsis
File_object.write(str)
Note
l When using the Write function, you need to open the existing file in a read mode through
the Open function.
l When the file is opened in a 'w'or 'w+'mode, the written data overwrites the original data
of the file. When the file is opened in an 'a'or 'a+'mode, the written data is appended to the
end of the file.
Parameter Description
Parameter
Description
Name
Return Value
None.
Error Handling
None.
Example
fp = Open("d:\\Hello.txt",'w')
str = "12345"
fp.write(str)
fp.close()
fp = Open("d:\\Hello.txt",'r')
read_str = fp.read()
fp.close()
Print(read_str)
Results
12345
Synopsis
File_object.close()
Note
None.
Parameter Description
None.
Return Value
None.
Error Handling
None.
Example
fp = Open("d:\\Hello.txt")
fp.close()
Synopsis
FindFiles(Directory ,days[,bSubDirectory = False])
Note
It is recommended to specify an absolute path in Directory. If you specify a relative path, only
the current working directory is searched.
Parameter Description
Parameter
Description
Name
The parameter value is a string that indicates the folder path to be searched.
Directory Both the Windows path format ('\\') and UNIX path format ('/') are
supported.
The parameter value is an integer. The positive integer indicates that the
days files generated several days before are searched. The negative value
indicates that the files generated within several days are searched.
Return Value
A string list is returned. The list contains the absolute paths of the files that meet the search
conditions.
Error Handling
None.
Example
#Search /export/home/test for the files that were modified three days before. The subdirectories
files = FindFiles('/export/home/test', 3)
Print(files)
#Search d:/test for the files that were modified within three days. The subdirectories are also s
files = FindFiles('d:/test', -3, True)
Print(files)
Synopsis
MkDir(Path)
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is of Boolean. If the function is called successfully, True is returned. Otherwise,
False is returned.
Error Handling
None.
Related Examples
Synopsis
RmDir(Path)
Note
When a specified directory is deleted, the directory must be empty.
If Path is the existing work path, then the specified directory fails to be deleted.
Parameter Description
Parameter Description
Return Value
The return value is of Boolean. If the function is called successfully, True is returned. Otherwise,
False is returned.
Error Handling
None.
Related Examples
Synopsis
GetCwd()
Note
None.
Parameter Description
None.
Return Value
The return value is a string indicating the current working path.
Error Handling
None.
Related Examples
Synopsis
Remove(filename)
Note
l The file name represented by the filename parameter must exist and allows to be deleted.
l If the file to be deleted is being used, then the file fails to be deleted.
Parameter Description
Parameter Description
Return Value
The return value is of Boolean. If the function is called successfully, True is returned. Otherwise,
False is returned.
Error Handling
None.
Related Examples
Synopsis
Rename(Src,Dst)
Note
l The Src file must exist and allows to be accessed and modified.
l Dst must ensure that the name of a file or directory is unique. If the name of a file or directory
is the same as another name, then the rename operation fails.
l Scr and Dst must ensure that the rename operation is in accordance with the rule for naming
a file name on the current operating system.
Parameter Description
Parameter Description
Src is a string. It indicates the path of the original file, which may contain
Src the path with the default as the current path. It supports Windows-style
file path (containing \\) and Unix-style file path (containing /).
Parameter Description
Dst is a string. It indicates the path of the renamed file, which may contain
Dst the path with the default as the current path. It supports Windows-style
file path (containing \\) and Unix-style file path (containing /).
Return Value
The return value is of Boolean. If the function is called successfully, True is returned. Otherwise,
False is returned.
Error Handling
None.
Related Examples
Synopsis
ListDir(Path)
Note
l The directory specified by Path must be available.
l Files are arranged in the alphabetic order and do not display the symbols "." and ".." in the
file directory.
Parameter Description
Parameter Description
Return Value
The return value is a list containing the names of all files in the directory.
Error Handling
None.
Related Examples
Synopsis
MakeDirs(Path)
Note
This function can be used to create all the intermediate-level directories, including the leaf
directory.
Parameter Description
Parameter Description
Return Value
The return value is of Boolean. If the function is called successfully, True is returned. Otherwise,
False is returned.
Error Handling
None.
Related Examples
Synopsis
RemoveDirs(Path)
Note
The leaf directory to be removed is empty, removing succeeds. Otherwise, removing fails. Then
you need to remove the parent directory of this leaf directory recursively.
Parameter Description
Parameter Description
Return Value
The return value is of Boolean. If the function is called successfully, True is returned. Otherwise,
False is returned.
Error Handling
None.
Related Examples
Example
#Create a directory
MkDir("d:\\Path")
MkDir("d:\\Path\\Path1")
MkDir("d:\\Path\\Path2")
#Create directories recursively
MakeDirs("d:\\Path\\Path3\\input")
#Get the current path
Print("Current path is:")
Print(GetCwd())
#Change the file name
Rename("d:\\Src.txt","d:\\Path\\Dst.txt")
#List all the files in the specified folder
lst = ListDir("d:\\Path")
Print("The file contained in d:\\Path is:")
Print(lst)
#Remove the specified file
Remove("d:\\Path\\Dst.txt")
#Remove the specified folder
RmDir("d:\\Path\\Path1")
#Remove the folder recursively
RemoveDirs("d:\\Path\\Path3\\inPut")
Result
Assume that the current path is d:, so the results is as follows.
l The iSStar provides the work area for GUI interactive interface (It is short for form). This
function enables you to input multiple pieces of information on the task once through the
form.
l This function allows you to customize the form to display the user-defined controls. The
GUI interactive components are placed in the form. This work area is integrated in the task
running window.
l The form view is hidden by default. The GUI interactive library, however, provides the
function for displaying the form. If the function for displaying the form is called, the form
view is displayed. After the form is submitted and the interaction is complete, the form is
hidden automatically.
l The GUI interactive library provides multiple controls to support the function of service
interaction. The controls include the single-line input control, password control, radio
control, checkbox control, and NE display control. The iSStar can automatically lay out
the controls on a form view. In addition, you can also adjust the layout flexibly and easily.
For details, see 5.14.2 Introduction to GUI Interactive Library Controls.
NOTE
The GUI functions are provided for the locals tasks; therefore, these functions cannot be called when you perform
the remote tasks.
The GUI interactive library functions provided by the iSStar are listed in Table 5-30.
Function Description
5.14.8 Function: Enter This function enables you to create a feed line
control.
5.14.11 Function: GetValue This function enables you to obtain the input
information on controls.
5.14.13 Examples of GUI Interactive Library Function shows examples of creating a GUI
interactive interface. The procedure is as follows:
1. Create a blank form. For details, see 5.14.3 Function: CreateForm.
2. Create and customize the controls provided by the library. Then, add the controls to the
form. For details, see 5.14.2 Introduction to GUI Interactive Library Controls.
3. Adjust the layout of the controls. For details, see 5.14.2 Introduction to GUI Interactive
Library Controls.
4. Call the function for displaying the form. The form controls are displayed. For details, see
5.14.10 Function: ShowForm.
5. After interaction, obtain the input information on the interactive interface. For details, see
5.14.11 Function: GetValue.
6. Remove the form if required. For details, see 5.14.12 Function: DeleteForm.
Composition of a A form view consists of title area, control area, and button area, as shown
form view in the following figure.
l Title area: Located on the top of a form view. This area displays the
title of the form. The contents of the title area are customized when
you create the form.
l Control area: This area displays the custom controls, such as ratio
controls and input controls. This area is located in the middle of a form
view.
l Button area: This area displays the buttons in a form view. You can
customize the number of buttons and the characters over the buttons.
For details, see 5.14.3 Function: CreateForm.
Layout of the The controls are arranged horizontally, that is, the controls are arranged
controls in the from left to right according to the sequence of creation time, as shown in
control area the following figure.
Label(form1,100, "label1")
Label(form1,100, "label2")
Label(form1,100, "label3")
ShowForm(form1)
Concept Description
Usage of Auxiliary layout controls are used to adjust the layout of the interface.
auxiliary layout Two types are available, that is, placeholder control and line feed control.
controls l Placeholder control: used to adjust the horizontal location of the
controls in a line. The control does not display any character.
l Line feed control: used to adjust the vertical location of the controls.
All the controls after a line feed character are displayed in a new line.
The effect that uses the placeholder control is shown in the following
figure.
Space(form1,100)
Label(form1,100, "label1")
Label(form1,100, "label2")
Label(form1,100, "label3")
ShowForm(form1)
The effect that uses the line feed control is shown in the following figure.
Label(form1,100, "label1")
Enter(form1)
Label(form1,100, "label2")
Enter(form1)
Label(form1,100, "label3")
ShowForm(form1)
Synopsis
CreateForm (title, buttonList)
Precaution
None.
Parameter Description
Parameter Description
Return Value
The return value is an integer. If the function is successfully called, the form ID is returned.
Otherwise, a non-positive integer is returned.
NOTE
The form ID uniquely identifies a form object. A valid form ID is a positive integer.
Error Handling
None.
Example
form1 = CreateForm(" This is a form.",["Confirm"])
ShowForm(form1)
DeleteForm(form1)
Synopsis
Label(formId, width, text)
Note
The height of the control is twenty-one pixels and cannot be set.
Parameter Description
Parameter Description
Return Value
The return value is an integer. In case of success, the ID of the created label control is returned.
Otherwise, 0 is returned.
The ID of a valid label control is a positive integer.
Error Handling
None.
Example
form1 = CreateForm(" Welcome !",["Confirm"])
Label(form1,180, " This is label.")
ShowForm(form1)
DeleteForm(form1)
Synopsis
Edit(formId, width, text= " ", bPwd = False)
Note
The height of the control is twenty-one pixels and cannot be set.
Parameter Description
Parameter Description
Parameter Description
Return Value
The return value is an integer. In case of success, the ID of the created text input control is
returned. Otherwise, 0 is returned.
Error Handling
None.
Example
bform1 = CreateForm(" Welcome !",["Confirm", "Cancel"])
ShowForm(form1)
DeleteForm(form1)
Synopsis
CheckBox(formId, width, caption, selected = False)
Note
The height of the control is fixed and cannot be set.
Description
Parameter Description
Parameter Description
Return Value
The return value is an integer. In case of success, the ID of the check box control is returned.
Otherwise, 0 is returned.
Error Handling
None.
Example
form1 = CreateForm(" Welcome !",["Confirm"])
CheckBox(form1, 150, "CheckBox")
ShowForm(form1)
DeleteForm(form1)
Synopsis
RadioBoxGroup(formId, width, choices, caption, dimension=1)
Note
The height of the control is twenty-one pixels and cannot be set.
Description
Parameter Description
Parameter Description
Return Value
The return value is an integer. In case of success, the ID of the RadioBoxGroup control is
returned. Otherwise, 0 is returned.
Error Handling
None.
Example
form1 = CreateForm(" Welcome !",["Confirm"])
choices = ['one','two','three','four','five']
caption = 'A Radio Box'
RadioBoxGroup(form1, 200, choices, caption, 2)
ShowForm(form1)
DeleteForm(form1)
Synopsis
Enter(formId)
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is an integer. In case of success, the ID of the feed line control is returned.
Otherwise, 0 is returned.
Error Handling
None.
Example
form1 = CreateForm(" Welcome !",["Confirm"])
Label(form1,150, "line1")
Enter(form1)
Label(form1,150, "line2")
ShowForm(form1)
DeleteForm(form1)
Synopsis
space(formId, width)
Note
The height of the control is twenty-one pixels and cannot be set.
Parameter Description
Parameter Description
Return Value
The return value is an integer. In case of success, the ID of the created placeholder control is
returned. Otherwise, 0 is returned.
Error Handling
None.
Example
form1 = CreateForm(" Welcome !",["Confirm"])
Label(form1,150, "Line1: begin")
Label(form1,50, "end")
Enter(form1)
ShowForm(form1)
DeleteForm(form1)
Synopsis
ShowForm (formId)
Note
l A form is not automatically displayed after you call the CreateForm function. You need to
call the ShowForm function in the script to display the created form.
l For a task that does not support the interaction with the GUI, calling the ShowForm function
leads to the termination of the task.
Parameter Description
Parameter Description
Return Value
After you call the ShowForm function, the script continues to be executed until you complete
the interaction operation in the form.
The return value is the text displayed on the button that indicates the completion in the form.
For example, in the form, click Continue to complete the interaction. The return value of the
ShowForm function is Continue.
l If the formId entered in the ShowForm function is invalid, for example, no form is
corresponding to the formId, the return value of the ShowForm function is None.
l If calling the ShowForm function fails, None is returned.
Error Handling
None.
Example
form1 = CreateForm(" Welcome !",["Confirm"])
ShowForm(form1)
DeleteForm(form1)
Synopsis
GetValue(componentId)
Note
l You can call this function only after it is displayed in the home form and the interaction is
complete.
l The return value is None if you call this function to obtain the input information before the
controls are displayed.
l The GetValue function is applicable to only the controls that support the input function.
For the controls that do not support the input function, such as the Space and Label controls,
the return value is None.
Parameter Description
Parameter Description
Return Value
The return value is related to the type of the control. For details, see Table 5-33.
Error Handling
None.
Synopsis
DeleteForm(formId)
Precaution
After a form is created, you can repeatedly call the ShowForm function to display the form many
times. A form cannot be displayed once being deleted.
Parameter Description
Parameter Description
Return Value
None.
Error Handling
None.
Example
form1 = CreateForm(" Welcome !",["Confirm"])
ShowForm(form1)
DeleteForm(form1)
Example
#Create the first form.
form1 = CreateForm(" Welcome !",["Confirm", "Cancel"])
#Display a dialog box and return the characters on the button clicked.
userSelect = ShowForm(form1)
# The index counts from 0. "2" corresponds to index 2. That is, the third option is correct.
if GetValue(hRadio1) == 2
Print (strName +"," + " you are right ^_^")
else
Print (strName + "," + " you are wrong.")
end
DeleteForm(form2)
else
Print("User canceled. Bye Bye!")
end
The iSStar provides task management functions. These functions enable you to create the
required sub tasks when the task is running, obtain the value of the extension parameter of the
project and exit from the running script.
5.15.2 Function: CreateTask
This function is used to create a sub task. When the task is running, you can call the CreateTask
function to create a sub task for concurrently running other required scripts.
5.15.3 Function: Wait
This function is used to wait for the sub task to be executed.
5.15.4 Function: GetRegisterKey
This function is used to obtain the value of the task parameter, or the value of the extension
parameter of the project.
5.15.5 Function: Exit
This function is used to exit from the running script.
A task is a process in which a group of related script files are executed. The scripts in the task
are run in serial mode. If these scripts need to call other scripts when the task is running and
these called scripts are not associated, you can call the task management function to create sub
tasks for concurrently running these called scripts, improving the execution efficiency.
The task management functions provided by the iSStar are listed in Table 5-34.
Function Description
5.15.2 Function: CreateTask This function is used to create sub tasks for
concurrently running other scripts required
by the task.
5.15.4 Function: GetRegisterKey This function is used to obtain the value of the
task parameter, or the value of the extension
parameter of the project.
5.15.5 Function: Exit This function is used to exit from the running
script.
Synopsis
CreateTask(filename[,kwargs])
Note
None.
Parameter Description
Parameter Description
Return Value
The return value is a tuple (errcode, taskid). The meanings of the two elements in the tuple are
as follows:
l errcode is the error code in integer type. 0 indicates that creation is successful.
l taskid indicates the returned task ID when the sub task is created successfully. taskid is a
string.
Error Handling
If an error occurs, you can obtain the error information through 5.10.2 Function:
GetLastError and 5.10.2 Function: GetLastError.
Example
Print("This is main task.")
for i in range(5)
Print("In main task we create a subtask.")
errorcode,taskid1 = CreateTask("task1.hsl")
if (errorcode == 0) #If 0 is returned, it indicates that creating the sub task is successful
Print("Subtask id is "+taskid1) #Print the ID of the sub task.
Print("Invoke Wait interface.")
Wait(taskid1) #Call the Wait function, wait until the sub task is executed, and continue
end
end
Synopsis
Wait(taskID)
Note
None.
Parameter Description
Parameter Description
taskID is a string. It indicates the task ID, that is, the taskid of the
taskID
return tuple after the CreateTask function is called successfully.
Return Value
None.
Error Handling
None.
Synopsis
GetRegisterKey(key)
Note
None
Parameter Description
Parameter Name Description
Return Value
In case of success, return the value of key. Otherwise, return None.
Error Handling
None
Example
ret = GetRegisterKey('aa')
Print(ret)
Result
None
Synopsis
Exit(errID)
Note
None
Parameter Description
Parameter Name Description
Return Value
None
Error Handling
None
Example
Create the test.hsl script whose content is:
Print("hello")
Exit(0x10)
Print("----------------")
Result
hello
.................
16
When the value of an expression is False, a running task is interrupted, and the exception
information is output.
Function Description
5.16.4 Function: Assert_OFF This function is used to turn off the switch of
the Assert function and invalidate the Assert
function.
Synopsis
Assert(cond,prompt='')
Note
By default, the Assert function is invalid. You need to set the Assert function to valid through
the Assert_ON function.
Parameter Description
Parameter Description
Return Value
None.
Error Handling
None.
Synopsis
Assert_ON()
Note
By default, the Assert function is invalid.
Parameter Description
None.
Return Value
None.
Error Handling
None.
Synopsis
Assert_OFF()
Note
None.
Parameter Description
None.
Return Value
None.
Error Handling
None.
Synopsis
CreateLoginInfo(SERVER_ADDR,SERVER_PORT)
Note
None.
Description
Parameter Description
Return Value
Return the data dictionary of the mail server information.
Set the value based on the key value of the data dictionary. It is used to set other optional
information of the mail server. The options that can be set include:
l SSL_MODE: SSL_MODE is a dictionary key value. It indicates whether the mail server
supports SSL mode. The options are Boolean values, True or False. The default value is
True.
l NICK_NAME: NICK_NAME is a dictionary key value. It indicates the nick name of the
user. The value is a string of characters.
l USER_NAME: USER_NAME is a dictionary key value. It indicates the mail user
registered on the mail server. The value is a string of characters.
l PASSWORD: PASSWORD is a dictionary key value. It indicates the password of the mail
user. The value is a string of characters.
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
# Replace smtp.test.com in the following example with the actual domain name of the smtp mail serv
# Set the information of the mail server. The default port number is 25.
loginInfo=CreateLoginInfo('smtp.test.com')
# Set the following information as required.
loginInfo['SSL_MODE']=False
loginInfo['NICK_NAME']='tester'
loginInfo['USER_NAME']=''
loginInfo['PASSWORD']=''
mailInfo2['MAIL_SUBJECT']='test2'
mailInfo2['MAIL_BODY']='this is test2'
# Call the mail sending function to send the mail customized in mailInfo1. Check the receivers' ma
result1=SendMail(mailInfo1)
result2=SendMail((mailInfo1,mailInfo2))
Print(result1)
Print(result2)
errorInf2=result2[1]
errorCode=errorInf2[0]
errorMsg=errorInf2[1]
Result
# The result of Print(result1)
(0, 'success')
Synopsis
CreateMailInfo()
Note
None
Description
None
Return Value
Return the data dictionary of mail information.
Set the value based on the key value of the data dictionary. It is used to set other optional
information of the mail server. The options that can be set include:
l FROM_ADDR: FROM_ADDR is a dictionary key value. It indicates the receiver address
of the mail. The value is a string of characters.
l TO_ADDR: TO_ADDRis a dictionary key value. It indicates the address list of the mail
to be sent. The value is a string of characters, or a tuple or list of character strings.
NOTE
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
# Replace smtp.test.com in the following example with the actual domain name of the smtp mail serv
# Set the information of the mail server. The default port number is 25.
loginInfo=CreateLoginInfo('smtp.test.com')
# Set the following information as required.
loginInfo['SSL_MODE']=False
loginInfo['NICK_NAME']='tester'
loginInfo['USER_NAME']=''
loginInfo['PASSWORD']=''
# Call the mail sending function to send the mail customized in mailInfo1. Check the receivers' ma
result1=SendMail(mailInfo1)
result2=SendMail((mailInfo1,mailInfo2))
Print(result1)
Print(result2)
errorInf2=result2[1]
errorCode=errorInf2[0]
errorMsg=errorInf2[1]
Result
# The result of Print(result1)
(0, 'success')
Synopsis
SendMail(mailInfos)
Note
None.
Description
Parameter Description
Return Value
If the parameter is a singular mailInfo instance or a list composed by one mailInfo instance, this
function returns an struct including error code and error message; if the parameter is a list
composed by multiple mailInfo instance (two or more), this function returns a same-length list
which is composed by the corresponding structs including error code and error message.
Errors that occur during mails sending can be located based on error codes. There are six kinds
of error codes:
l 0: Successful execution
l 1: Error in SMTP server connection
l 2: Login error
l 3: Incorrect mail address
Error Handling
Obtain the error information by using the GetLastError function and the GetErroMsg function.
Example
# Replace smtp.test.com in the following example with the actual domain name of the smtp mail serv
# Set the information of the mail server. The default port number is 25.
loginInfo=CreateLoginInfo('smtp.test.com')
# Set the following information as required.
loginInfo['SSL_MODE']=False
loginInfo['NICK_NAME']='tester'
loginInfo['USER_NAME']=''
loginInfo['PASSWORD']=''
# Call the mail sending function to send the mail customized in mailInfo1. Check the receivers' ma
result1=SendMail(mailInfo1)
result2=SendMail((mailInfo1,mailInfo2))
Print(result1)
Print(result2)
errorInf2=result2[1]
errorCode=errorInf2[0]
errorMsg=errorInf2[1]
Result
# The result of Print(result1)
(0, 'success')