Documente Academic
Documente Profesional
Documente Cultură
V200R008
Issue
01
Date
20081208
Huawei Technologies Co., Ltd. provides customers with comprehensive technical support and service. For any
assistance, please contact our local office or company headquarters.
Website:
http://www.huawei.com
Email:
support@huawei.com
Notice
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 the statements, information, and
recommendations in this document do not constitute a warranty of any kind, express or implied.
M2000
iSStar User Guide
Contents
Contents
About This Document.....................................................................................................................1
1 iSStar Overview..........................................................................................................................1-1
1.1 Product Features of iSStar...............................................................................................................................1-3
1.2 Basic Concepts of iSStar.................................................................................................................................1-3
1.3 iSStar Application Scenarios...........................................................................................................................1-5
1.4 iSStar Software Architecture...........................................................................................................................1-7
1.5 Functions of iSStar..........................................................................................................................................1-8
1.5.1 Script File Development.........................................................................................................................1-8
1.5.2 Script Application Management...........................................................................................................1-15
1.5.3 Script Task Management......................................................................................................................1-17
1.5.4 HSL Language......................................................................................................................................1-20
1.6 iSStar Script Sample......................................................................................................................................1-22
1.7 iSStar Technical Specifications.....................................................................................................................1-26
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
Issue 01 (20081208)
M2000
iSStar User Guide
Contents
Issue 01 (20081208)
M2000
iSStar User Guide
Contents
iii
M2000
iSStar User Guide
Contents
Issue 01 (20081208)
M2000
iSStar User Guide
Contents
M2000
iSStar User Guide
Contents
Issue 01 (20081208)
M2000
iSStar User Guide
Contents
Index.................................................................................................................................................i-1
Issue 01 (20081208)
vii
M2000
iSStar User Guide
Figures
Figures
Figure 1-1 iSStar system deployment.................................................................................................................. 1-7
Figure 1-2 iSStar Main Window........................................................................................................................1-9
Figure 1-3 iSStar Debug window.....................................................................................................................1-11
Figure 1-4 iSStar Execute Window..................................................................................................................1-13
Figure 1-5 iSStar Execute Window..................................................................................................................1-14
Figure 1-6 iSStar Application Management window.....................................................................................1-16
Figure 1-7 iSStar Task Manage Window........................................................................................................1-18
Figure 3-1 Progress for developing scripts...........................................................................................................3-2
Figure 3-2 Script Application Operation Flow Chart...........................................................................................3-3
Figure 3-3 State transition of a running task......................................................................................................3-18
Figure 3-4 State transition of a debugging task..................................................................................................3-19
Figure 3-5 State transition of a scheduled task...................................................................................................3-20
Figure 5-1 Procedure for using NE operation functions...................................................................................... 5-5
Figure 5-2 Workflow of MML message parsing functions................................................................................5-32
Figure 5-3 MML message format......................................................................................................................5-33
Figure 5-4 Elements in the report.......................................................................................................................5-68
Figure 5-5 Workflow of alarm message parsing functions................................................................................5-74
Figure 5-6 Alarm Message Format....................................................................................................................5-75
Figure 5-7 Procedure for using database operation functions..........................................................................5-121
Figure 5-8 Procedure for modifying a report...................................................................................................5-258
Figure 5-9 Optional colors...............................................................................................................................5-259
Issue 01 (20081208)
ix
M2000
iSStar User Guide
Tables
Tables
Table 1-1 Basic concepts involved in the iSStar..................................................................................................1-3
Table 1-2 Description of iSStar Main Window..................................................................................................1-9
Table 1-3 Description of iSStar Debug Window..............................................................................................1-11
Table 1-4 Description of the output area............................................................................................................1-12
Table 1-5 Description of iSStar Execute Window...........................................................................................1-15
Table 1-6 Description of the iSStar Application Management window.........................................................1-16
Table 1-7 Description of the parameters of iSStar Task Manage Window.....................................................1-18
Table 1-8 Shortcut buttons.................................................................................................................................1-19
Table 1-9 HFC function library..........................................................................................................................1-21
Table 1-10 List of self-defined functions of CPU load query script..................................................................1-25
Table 1-11 iSStar running environment specifications......................................................................................1-26
Table 1-12 Performance specifications of iSStar...............................................................................................1-26
Table 2-1 Directory structure of the iSStar client.................................................................................................2-2
Table 2-2 iSStar User Right List.......................................................................................................................... 2-7
Table 3-1 State transition of a running task........................................................................................................3-19
Table 3-2 State transition of a debugging task...................................................................................................3-19
Table 3-3 States of a scheduled task...................................................................................................................3-20
Table 4-1 Keywords............................................................................................................................................. 4-3
Table 4-2 MML statements.................................................................................................................................. 4-4
Table 4-3 Basic operators.....................................................................................................................................4-4
Table 4-4 String format........................................................................................................................................ 4-6
Table 4-5 Formats for writing a comment............................................................................................................4-6
Table 4-6 Classification......................................................................................................................................4-11
Table 4-7 Numeric operations............................................................................................................................4-11
Table 4-8 String object methods.........................................................................................................................4-15
Table 4-9 Special Character...............................................................................................................................4-19
Table 4-10 Rule of escape characters.................................................................................................................4-20
Table 4-11 List object methods..........................................................................................................................4-21
Table 4-12 Operations on dictionary objects......................................................................................................4-22
Table 4-13 Methods about dictionary objects....................................................................................................4-23
Table 4-14 Open function description................................................................................................................4-25
Table 4-15 File object methods..........................................................................................................................4-25
Table 5-1 List of NE operation functions.............................................................................................................5-4
Issue 01 (20081208)
xi
M2000
iSStar User Guide
Tables
xii
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Product Name
Product Version
M2000
V200R008
Intended Audience
The intended audience of this document are:
l
Maintenance engineers
Update History
01(2008-12-08)
This is the first formal release.
Brief Introduction
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
iSStar Overview
1-1
M2000
iSStar User Guide
1 iSStar Overview
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.
1-2
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
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.
Description
Script
Programs written in the HSL are used to provide specific service functions.
Issue 01 (20081208)
1-3
M2000
iSStar User Guide
1 iSStar Overview
Basic
Concepts
Description
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
development
platform
Script
application
platform
Indicates the platform for applying service function scripts. This platform
provides the function of managing applications.
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.
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.
Script
application
1-4
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.
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Basic
Concepts
Description
Script
application
bookmark
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.
Issue 01 (20081208)
Too many manual routine maintenance operations should be performed and some
operations are duplicated.
1-5
M2000
iSStar User Guide
1 iSStar Overview
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
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.
Reference
<Installation directory on the M2000 client>\script\samples\en\DailyCheck\sample.hsl
Real-Time Monitoring
l
Target users:
Staff in the monitoring team
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
1-6
Scenario Description
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
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.
Target users:
Staff in the configuration team
Scenario Description
If you need to modify the data of multiple NEs, you can compile a script based on the
service logic. Multiple NEs can execute the script concurrently or sequentially, and then
export the related information as required.
Target users:
Staff in the professional maintenance team
Scenario Description
You can compile iSStar scripts to extract data from the performance and alarm databases.
The extracted data can serve as the input data source for the analyzer of a third party. It can
also be used for statistical analysis so as to generate a report.
Issue 01 (20081208)
1-7
M2000
iSStar User Guide
1 iSStar Overview
Executor (descriptor) subsystem: parses scripts and executes and controls tasks.
HFC subsystem: provides a group of encapsulated service functions for script developers.
Service subsystem: provides a group of service scripts and script project packages for users.
1-8
In the main window, you can manage multiple script files. The number of script files, however, must
be less than 100.
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.
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Description
Project management
area
Information output
area
Issue 01 (20081208)
1-9
M2000
iSStar User Guide
1 iSStar Overview
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.
Tool bar
: cuts a script.
: copies a script.
: pastes a script.
l
l
: runs a task. You can also run a specific part of a script file.
: debugs a task.
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
CAUTION
l
A maximum of 50 debugging tasks and running tasks can be supported by the iSStar.
Description
Tool bar
Display area
Issue 01 (20081208)
1-11
M2000
iSStar User Guide
1 iSStar Overview
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.
Description
Message
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.
MML Response
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.
1-12
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
When debugging succeeds, the Stack tab page displays the full path
information invoked by the current function.
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Name
Description
Watch
The Watch tab page displays the change information of the variables
during the debugging of the script file.
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
cannot be edited.
l In the display area of iSStar Debug Window, right-click a variable and select
Figure 1-4 shows the running window displayed when a script file invokes the GUI
interactive library function.
Figure 1-5 shows the running window where the GUI interactive area is not displayed
when the script file does not invoke the GUI interactive library function.
The system supports a maximum of 50 debugging tasks and running tasks. But the system
supports only one debugging task.
Issue 01 (20081208)
1-13
M2000
iSStar User Guide
1 iSStar Overview
1-14
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Description
Tool bar
Provides control buttons for executing scripts. The meanings for the
buttons are as follows:
l
l
l
MML message
output area
MML command
statistic bar
GUI interactive
area
Displays the GUI interactive controls created after the script file invokes
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.
Issue 01 (20081208)
1-15
M2000
iSStar User Guide
1 iSStar Overview
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.
Figure 1-6 iSStar Application Management window
1-16
Description
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Tool bar
: adds a workstation.
: to add shortcuts.
: to delete shortcuts.
l
l
Workspace
Shortcut
Issue 01 (20081208)
1-17
M2000
iSStar User Guide
1 iSStar Overview
Description
on the server.
l By creating remote script tasks, you can share
the services.
1-18
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Parameter/Tab
Description
Script File
Task Type
State
Process
Start Time
End Time
Description
You can switch the window to iSStar Main Window.
After creating an empty task in iSStar Task Manage
Window, you can use this button to select the main file.
If you are required to select an NE for an executing task,
click this button and select an NE in the Please select
operation NE window.
Click this button to refresh iSStar Task manage
Window.
Issue 01 (20081208)
1-19
M2000
iSStar User Guide
1 iSStar Overview
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.
Sorts tasks. You can sort the tasks by the fields, such as Script File to quickly locate the
task that you want to view.
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.
Controlling tasks, including creating, copying, deleting, running, pausing, resuming, and
stopping a task.
Viewing the output information of the task, including viewing the print output and MML
output.
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
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.
Table 1-9 HFC function library
Function
Description
NE operation function
NMS Functions
Time function
GetError function
Issue 01 (20081208)
1-21
M2000
iSStar User Guide
1 iSStar Overview
Function
Description
Assertion function
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
1-22
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Communication status = Normal Read Temperature Sensor status = Normal FAN
Block status = Normal OverHeat status = Normal FAN Unsteadily status =
Normal
--END '''
# COLUMN_NAMES =['Module number','board type','frame number','slot
number','CPU usage','CPU status']
# TITLE = 'Routine check sample'
# Colwidths= [1,2,2,2,2,2]
####################################--Parameter Setting-end-####################################
####################################--Function definition-begin-####################################
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #^ Main function of
the program, responsible for basic logic of the program.
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ def Main() # Variable
initialized NEName = 'MSCServer1' Row = 0 ExpDataSet = []
# 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()
# Determine the message result exception information for RowValue in
ReportList Row = Row + 1 ExpColumns = CheckValue(RowValue) for Col in
ExpColumns ExpInfoLst = [ NEName, MMLCmd, COLUMN_NAMES[Col]+': '+RowValue
[Col], Row, Col ] ExpDataSet.append(ExpInfoLst)
# Print exception information, FormatList function is used to
convert List to character string
Print("exception information: " +
FormatList(ExpInfoLst[:-2])) end end
# Generate Excel report NewReport() SheetID = AddSheet(TITLE) TableID
= writeReport(SheetID, TITLE, COLUMN_NAMES, ReportList, Colwidths)
# Exception information is displayed in orange for i in range(len
(ExpDataSet)) SetCellBGColor(TableID, ExpDataSet[i][-2], ExpDataSet[i]
[-1], 17) end
# Save Excel report. If the suffix xls is changed to html, HTML report
is generated.
RepOutputFile = "C:/Routine check report sample.xls"
SaveReportAs(RepOutputFile)
Print('Finish checking NE. Report outputted to : %s' %RepOutputFile)
end
#MML command execution and message parsing function def ExecMMLCmd() #
Send MML command to NE to obtain messages. Being restricted by the running
environment, we use constant instead. ''' @DSP CPUR:; mml = GetMMLReport
() ''' mml = SampleMML1
p = ParseMMLRpt(mml)
# If MML command does not execute successfully, the system prompts
error and does not continue processing if not p or GetResultCode(p) !=
'0' Print('executing command %s fails. Reason: %s' %(GetMMLCmd(p),
GetResultCause(p)) ) return [],'' end
# If MML report has no corresponding entry information, the system
prompts error and does not continue processing if GetObjNum(p) < 1 Print
('No proper entry information found') return [],'' end
# Get some columns as required DataList = getColsByIdx(p,0,
[0,1,2,3,4,5])
Issue 01 (20081208)
1-23
M2000
iSStar User Guide
1 iSStar Overview
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
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.
Table 1-10 List of self-defined functions of CPU load query script
Function
Description
Principle
Main function
ExecMMLCmd function
CheckValue function
writeTable function
setColWidthList function
writeReport function
Issue 01 (20081208)
1-25
M2000
iSStar User Guide
1 iSStar Overview
Function
Description
Principle
getColsByIdx function
FormatList function
Configuration Requirement
Hardware Configuration
Software configuration
Performance Counters
Table 1-12 shows the performance specifications of iSStar.
Table 1-12 Performance specifications of iSStar
1-26
Item
Range
<=50
<=1
Issue 01 (20081208)
M2000
iSStar User Guide
1 iSStar Overview
Item
Range
<=500
<=100
<=1 MB
<=10
<=70
<=99999
Issue 01 (20081208)
1-27
M2000
iSStar User Guide
2 iSStar Management
iSStar Management
Issue 01 (20081208)
2-1
M2000
iSStar User Guide
2 iSStar Management
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.
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.
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.
2-2
Directory
Description
Issue 01 (20081208)
M2000
iSStar User Guide
2 iSStar Management
Directory
Description
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.
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.
Issue 01 (20081208)
2-3
M2000
iSStar User Guide
2 iSStar Management
GUI
1.
Choose Monitor > System Monitor > Monitor Browser. The System Monitor
Browser window is displayed.
2.
Click Service Monitor. If the scriptserver_agent process is listed on the tab page
and its status is Running, you can infer that the scriptserver_agent process runs
properly.
Command line
1.
2.
2-4
Issue 01 (20081208)
M2000
iSStar User Guide
2 iSStar Management
Issue 01 (20081208)
2-5
M2000
iSStar User Guide
2 iSStar Management
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.
2-6
Issue 01 (20081208)
M2000
iSStar User Guide
2 iSStar Management
Description
Type
Local operations
Network management
application authority
Running scripts
Debugging scripts
Network management
application authority
2.
In the Security Management window, extend the User node in the Security
Management navigation tree and select the user to whom you want to set rights.
3.
On the right part of the window, click the Operation Rights tab.
4.
5.
In the Add Operation Rights dialog box, select the right type and the corresponding right,
and then click OK.
Select Network Management Application as the Type.
You can select Local Operation or Scheduled Task Operation in the Operation
Rights area to set the specific right.
Issue 01 (20081208)
2-7
M2000
iSStar User Guide
3 iSStar Operation
iSStar Operation
Issue 01 (20081208)
3-1
M2000
iSStar User Guide
3 iSStar Operation
Analyze services
Analyze services, know the specific requirements of the services, determine the functions
and performance to be provided by the service scripts, determine implementation principles
and implementation methods. On such basis, determine the script structure and data
structure and algorithms to be used.
2.
3.
3-2
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
4.
Scripts
If a service is implemented through scripts, you can run the scripts in iSStar Main
Window. For details , see 3.3.2 Running a Script File.
Script projects
If the service functions are complex and are organized as projects, you can run the script
projects in iSStar Main Window. For details, see 3.3.3 Running a Script Project.
Script applications
If the services are packed into a script project package, see Figure 3-2 for the operation
procedure.
2.
Issue 01 (20081208)
Downloading the data from the server. For details, see 3.4.2 Downloading a Script
Application to the Local Terminal.
3-3
M2000
iSStar User Guide
3 iSStar Operation
4.
For some applications, you need to select the NEs before running the applications.
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.
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.
3-4
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is
displayed.
Step 2 Click
New.
. Alternatively, right-click the tab bar of the script editing area, and then choose
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
Paste
Click
Press Ctrl+X.
Select the text to be copied and copy the selected text in one of the
following three ways:
l
Click
Press Ctrl+C.
Position the cursor at the place where you plan to paste. Paste the
text in one of the following three ways:
l
Click
Press Ctrl+V.
NOTE
l You can perform the pasting operation only in the script editing area of
Issue 01 (20081208)
3-5
M2000
iSStar User Guide
3 iSStar Operation
Operation
Procedure
Find
Find a specific string in the current script files. You can choose
either of the following two methods:
l
Press Ctrl+F.
NOTE
l Cyclic find all is supported.
l You cannot enter the new-line character.
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
Replace
Press Ctrl+R.
NOTE
l Cyclic replace all is supported.
l You cannot enter the new-line character.
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
Undo
Press Ctrl+Z.
NOTE
Only the last 100 operations can be undone.
Redo
Press Ctrl+Y.
NOTE
The number of redo operations is equal to that of undo operations.
3-6
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
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.
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.
Press Ctrl+F2.
NOTE
l If the current line is not marked, a bookmark is added.
l If the current line is marked, the bookmark is deleted.
l You can set a maximum of 32 bookmarks for one script file.
l The bookmarks are not saved after the file is closed.
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
Save.
. Alternatively, right-click the tab bar of the script editing area, and then choose
NOTE
If it is the first save, the Save As is displayed. Specify the path and file name and click Save.
----End
Issue 01 (20081208)
3-7
M2000
iSStar User Guide
3 iSStar Operation
Prerequisite
l
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...
Stop
Click
NOTE
After the debugging is complete, the
greyed out.
3-8
button is
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
If...
Then...
Step Over
Click
NOTE
l If the next step calls functions or script files, the
Step Into
Click
NOTE
l If the next step calls functions or script files, the
Step Out
Click
NOTE
l If the system is executing the internal function, the
Continue
Click
NOTE
l If you set breakpoints in the script files that are
Issue 01 (20081208)
3-9
M2000
iSStar User Guide
3 iSStar Operation
If...
Then...
Click
Press F9.
NOTE
You can set a maximum of 32 breakpoints for one file.
The breakpoints are not saved after the file is closed.
Click
on the toolbar.
Press F9.
3-10
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
If...
Then...
NOTE
l After the iSStar Debug Window window is
Add to Watch
NOTE
l A maximum of 32 watch variables can be added.
l On the Watch tab page of the iSStar Debug
Click
. The iSStar Main Window window
is displayed. You can edit the currentlydebugging script file.
NOTE
A debugging script is modified in the iSStar Main
Window. The modified script takes effect upon the
next debugging.
Click
. The iSStar Task Manage
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.
Issue 01 (20081208)
3-11
M2000
iSStar User Guide
3 iSStar Operation
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.
The MML Response tab page contains the MML commands and displayed information
during the running and debugging of the script file.
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.
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
Project. Alternatively, click
NOTE
If a project is open in the active window, the Confirm dialog box is displayed, prompting you to Confirm
to close the project. Click Yes to close the project.
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.
Main file: indicates the entry file of the project. You can set this parameter after creating a
project and adding script files.
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.
File list: displays the main file information about the project when main file is set.
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
Step 5 In the navigation tree of the project management area, you can perform the following operation
to create a script project.
If You Plan to...
Then...
Create a file,
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
project,
Delete a file,
Issue 01 (20081208)
3-13
M2000
iSStar User Guide
3 iSStar Operation
Then...
Pack a project,
Close a project,
Delete a project,
----End
Prerequisite
l
Context
When you plan to debug a script project, the system creates a debugging task for the script
project.
3-14
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
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
Project.
. Alternatively, right-click the project management area, and then choose Open
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.
The MML Response tab page contains the MML commands and displayed information
during the running and debugging of the script file.
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.
The Watch tab page displays the change information of the variables during the debugging
of the script file.
Postrequisite
during the debugging. The iSStar Main Window window is displayed. You can edit
Click
the currently debugging script file.
3-15
M2000
iSStar User Guide
3 iSStar Operation
Prerequisite
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.
You can organize different script applications into different workspaces as required.
Context
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.
Step 2 Perform operations according to whether to create a workspace.
Whether to Create a Workstation Procedure
No
Yes
Step 3 Click
. Alternatively, right-click the blank area of Workspace, and then choose Add
Bookmark. The Add Bookmark window is displayed.
Step 4 Set the corresponding parameters in the Add Bookmark window.
Select the Application Type. Enter the Bookmark Name. Then, click
Icon File.
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
1. Click
1. Click
2. In the Remote File Summary window, select a project file, and then
click OK.
Step 6 Click OK.
----End
3-17
M2000
iSStar User Guide
3 iSStar Operation
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.
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
3-18
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
Description
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.
Running
Finished
The task has finished running. After a script file finishes running,
it is in the finished state.
Terminated exceptionally
Pausing
The system is pausing the task. The task is transiting from the
running state to the paused state.
Paused
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.
Figure 3-4 State transition of a debugging task
Description
Suspended
Debugging
Debug finished
Terminated exceptionally
Issue 01 (20081208)
3-19
M2000
iSStar User Guide
3 iSStar Operation
Description
Idle
Running
Finished
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.
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
Prerequisite
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.
Each time you run a script file, the system creates a corresponding script task.
Context
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
NOTE
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
a script file.
, select Select Task and Run, and in the displayed Open dialog box select
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
Execution.
Step 5 In the iSStar Execute Window, you can perform the following operations as required.
If You Plan to...
Then...
Click
NOTE
Only the running script can be stopped. In other situations,
appears dimmed.
Click
NOTE
Only a script that has finished running can be re-executed. In
other situations,
Issue 01 (20081208)
appears dimmed.
3-21
M2000
iSStar User Guide
3 iSStar Operation
Then...
Click
NOTE
Only the running script can be paused. In other situations,
appears dimmed.
Click
, you can locate the directory of the system's
output files.
NOTE
After a script finishes running, you can view the output
directory. In other situations,
Click
appears dimmed.
NOTE
l After you close iSStar Execute Window, the
Click
. The iSStar Main Window window is
displayed.
Prerequisite
3-22
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
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.
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
1.
Choose Maintenance > iSStar > Development Platform . The iSStar Main
Window is displayed.
2.
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
.
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
3-23
M2000
iSStar User Guide
3 iSStar Operation
Prerequisite
l
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.
Whether to Select an NE Procedure
No
Go to Step 4.
Yes
1. Click
or
. The Please select an operation NE dialog
box is displayed.
NOTE
l The
l
Procedure
Execute immediately You can use one of the following methods to run an application:
3-24
Click
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
Running Mode
Procedure
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
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
Issue 01 (20081208)
3-25
M2000
iSStar User Guide
3 iSStar Operation
Area
Description
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 cannot enter the new-line character.
l Wildcard search is not 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
3-26
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
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.
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.
Task Type
Procedure
Immediate tasks
1. Click
2. Go to Step 3.
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
Issue 01 (20081208)
3-27
M2000
iSStar User Guide
3 iSStar Operation
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.
2.
Click
3.
In the iSStar Task Manage Window window, right-click the task to be viewed, and
then choose View Output.
on the toolbar.
To view the MML message output information, perform the following steps:
1.
Choose Maintenance > iSStar > Development Platform. The iSStar Main
Window is displayed.
2.
Click
3.
In the iSStar Task Manage Window window, right-click the task to be viewed, and
then choose View MML Output.
on the toolbar.
2.
In the navigation tree, choose Task Type > Other > Script Executor . In the right
window, select a task that has already been executed.
3.
Click Save Log. In the displayed Please select a directory window, set the file save
path.
4.
Click OK.
NOTE
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.
3-28
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is
displayed.
Step 2 Click
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 2 Click
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
Issue 01 (20081208)
3-29
M2000
iSStar User Guide
3 iSStar Operation
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.
Deleting a script task does not involve the deletion of the script of the script task and of the
script project.
Procedure
Step 1 Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is
displayed.
Step 2 Click
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 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
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
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.
If you need to check remote script applications, ensure that the connection between the
client and the M2000 server is normal.
To view the information about the local script application, perform the following steps:
Procedure
1.
2.
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.
l
Issue 01 (20081208)
To view the information about the remote script application, perform the following steps:
1.
2.
You can perform the following operations according to the existence of the
corresponding bookmark of the script application.
3-31
M2000
iSStar User Guide
3 iSStar Operation
If...
Then...
1. Click
. The Remote File
Summary window is displayed.
2. Select a script application from
Remote File Summary.
3. Click Details. The Remote File
Details window is displayed.
You can view Basic Parameter and
Preset Parameter.
NOTE
You can check and modify the remote
applications created by yourself. You can
only view but not modify the remote
applications created by other users.
----End
Prerequisite
l
Procedure
Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application
Management window is displayed.
Step 2 Click the target workstation to use the existing workstation.
Step 3 You can perform the following operations based on whether the iSStar Application
Management window has the bookmark of the corresponding script application.
3-32
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
If...
Then...
1. Click
. The Remote File Summary
window is displayed.
2. Select a script application from Remote
File Summary.
3. Click Download. The Open window is
displayed.
4. Set the file name and save path in the
Open window, and then click Open.
NOTE
l Remote File Summary lists all the script
----End
Prerequisite
l
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.
Issue 01 (20081208)
3-33
M2000
iSStar User Guide
3 iSStar Operation
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.
----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.
The remote script applications are saved and executed on the server.
You can delete the script applications on the server issued by yourself or by other users.
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.
3-34
Issue 01 (20081208)
M2000
iSStar User Guide
3 iSStar Operation
Operation Entrance
Remote file management
Procedure
1. Click
. The Remote File Summary window is
displayed.
2. Select an application package from Remote File
Summary.
3. Click Remove.
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.
Delete a bookmark.
Right-click a bookmark, and then choose Delete Bookmark. In the displayed Confirm
prompt box, click Yes.
----End
Issue 01 (20081208)
3-35
M2000
iSStar User Guide
4 HSL Reference
HSL Reference
Issue 01 (20081208)
4-1
M2000
iSStar User Guide
4 HSL Reference
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.
The rules for naming an identifier are as follows:
4-2
Naming rule: An identifier can contain letters (a-z, A-Z), numbers (0-9), and underlines
(_). Number cannot be the leading character.
An identifier is case sensitive. For example, FOO and foo are different objects.
An identifier cannot be any keyword of HSL. For the keywords of HSL, see 4.1.2
Keywords.
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
4.1.2 Keywords
A keyword is also called a reserved word. It is an identifier pre-defined in HSL.
CAUTION
l
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.
Table 4-1 Keywords
and
del
for
is
raise
assert
elif
from
lambda
return
break
else
global
not
try
class
except
if
or
while
continue
exec
import
pass
yield
def
finally
in
end
4.1.3 Statement
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 maps to a text line. A line feed character (\n) is the end mark.
If you want to split a statement into multiple text lines, an extended line (\) must be used.
A text line can include multiple simple statements which are separated by semicolons (;).
NOTE
Issue 01 (20081208)
An extended line character cannot be used at the end of files, because semantic mistakes are caused.
4-3
M2000
iSStar User Guide
4 HSL Reference
MML Statement
An MML statement ends with ;. Parameters are separated by ,, and parameter expressions are
separated by =.
The MML statement has two types: line mode and block mode. Table 4-2 lists the two types of
MML statement.
CAUTION
Do not write both MML command statements and simple statements in the same text line.
Format
Line mode
@MMLCMD:MMLargs;
Block mode
@@@
MMLCMD:MMLargs;
MMLCMD:MMLargs;
MMLCMD:MMLargs;
@@@
Compound Statement
The compound statement has the following three types:
l
stmt] [else
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.
Table 4-3 Basic operators
Type
Basic
4-4
Operator
x+y
Description
Add
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Type
Bit-wise
Comparative
Bool
Sequence
Dictionary
Operator
Description
x-y
Subtract
x*y
Multiply
x/y
Divide
x%y
-x
Unary negation
+x
x ** y
x to the power of y
x << y
Left shift
x >> y
Right shift
x&y
Bitwise and
x|y
Bitwise or
~x
Bitwise exclusive
x<y
Less than
x>y
Greater than
x == y
Equal
x != y
Not equal
x >= y
x <= y
x or y
x and y
not x
s+r
Sequence cascade
s*n,n*s
d[k]
Issue 01 (20081208)
4-5
M2000
iSStar User Guide
4 HSL Reference
Description
d,i
g,G
For index smaller than -4 or higher precision, use %e or %E. Otherwise, use
%f.
r and repr()
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.
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.
Table 4-5 lists the formats for writing a comment.
Table 4-5 Formats for writing a comment
4-6
Comment Type
Writing Format
Line comment
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Comment Type
Writing Format
Block comment
[stmt;]"""This is
a multi-line comment.
"""[;stmt]
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
elif x == 0
Print("x is
elif x < 0
Print("x is
else
Print("x is
end
x = 0
if x > 0
Print("x is
elif x == 0
Print("x is
elif x < 0
Print("x is
else
Print("x is
end
x = -100
if x > 0
Print("x is
elif x == 0
Print("x is
elif x < 0
Print("x is
else
Print("x is
end
positive")
zero")
negative")
not a integer")
positive")
zero")
negative")
not a integer")
positive")
zero")
negative")
not a integer")
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.
Issue 01 (20081208)
4-7
M2000
iSStar User Guide
4 HSL Reference
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
I
I
I
can
can
can
can
count
count
count
count
to
to
to
to
1
2
3
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
3
4
5
6
7
4-8
is a prime number
is a prime number
equeals2 *
is a prime number
equeals2 *3
is a prime number
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
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
4.1.9 Function
A function is the basic multiplex unit provided by the language.
Issue 01 (20081208)
4-9
M2000
iSStar User Guide
4 HSL Reference
NOTE
The HSL does not support function re-loading. A newly-defined function automatically overwrites
the previous function with the duplicate name.
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.
Example
def showHello()
Print("Hello!")
end
showHello()
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.
4-10
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Value Example
Integer
1234,-24,0
Long integer
99999999999999999999L
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.
Table 4-7 Numeric operations
Operation
Description
x or y
Logical OR
x and y
Logical AND
not x
Logical NOT
Compare
x == y,x != y
Equal or not
x|y
Bitwise or
x^y
Bitwise exclusive or
x&y
Bitwise and
x << y, x>> y
x + y, x - y
Plus, subtract
x * y,x % y,x / y
-x,+x, ~x
x ** y
x to the power of y
Example
#Get the result of x**y.
x = 2
y = 3
Print(x**y)
Result
8
Issue 01 (20081208)
4-11
M2000
iSStar User Guide
4 HSL Reference
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.
Value Example
'',
'hello word!'
"spam's",
"""..."""
UnicodeType (Unicode
string)
u'hello word!'
ListType (list)
[],
[0,1,2,3,4,5,6],
['star',['sun','moon']]
TupleType (tuple)
(),
(3, 4, 5,),
(0, 2.3, 'star', 5),
('star', ('sun', 'moon'))
NOTE
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.
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
seq[i]
4-12
Description
Index. The index i is an integer. If the value of i is equal to or more
than 0, set the value of seq[i] to be the value of ith element counted
from the beginning of the sequence. If the value of i is less than 0,
set the value of seq[i] to be the value of -ith element counted from
the end of the sequence.
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Operation
Description
Index that is used for only lists and tuples. See Example 1:
Calculation in slices.
seq[i][j]
seq[i:j]
Slice. Select the elements from i to j in the indexes of seq. The step
length is s.
seq[i:j:s]
seq1 + seq2
seq1 * n
x in seq1
x not in seq1
len(seq)
Get the length of seq. See Example 3: Using len() to Get the
Lengths of str, list, and tuple.
min(seq)
max(seq)
and s.
Issue 01 (20081208)
4-13
M2000
iSStar User Guide
4 HSL Reference
Result
s[3] = 3
s[-1] = 9
s[2:6] = 2345
s[2:8:2] = 246
word !0123456789
word !word !word !
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)) )
#Get the length of list.
list1 = ['hello', 2, 4]
Print('Length of list1: ' + str(len(list1)) )
#Get the length of tuple.
tuple1 = ( ('star', ('sun', 'moon')) )
Print('Length of tuple1: ' + str(len(tuple1)) )
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))
#Get the minimum item in list1.
list1 = [3,4,5,8,9]
Print(min(list1))
#Get the minimum item in tuple1.
tuple1 = (10,4,6,8)
Print(min(tuple1))
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'
4-14
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Print(max(str1))
#Get the maximum item in list1.
list1 = [3,4,5,8,9]
Print(max(list1))
#Get the maximum item in tuple1.
tuple1 = (10,4,6,8)
Print(max(tuple1))
Results
s
9
10
String
A string consists of single or double quotation marks. For example, 'hello' and "world" are of
the string type.
Description
Returns a copy of the string with only its first character
capitalized.
s.capitalize()
Returns a string whose initial part and end part are filled with
fillchar. The middle part is the same as the original string .
s.center(width[,fillchar])
s.count(sub[,start[,end]])
s.endswith(suffix[,start
[,end]])
Issue 01 (20081208)
4-15
M2000
iSStar User Guide
4 HSL Reference
Method
Description
Returns a copy of the string. If the returned string contains
the escape character "\t" of tab, use the space to replace the
character. The default value of the parameter tabsize is 8.
The number of spaces to be replaced is the difference of
tabsize and the length of the string before "\t".
For example, if the string to be returned is aa\tbbbb\tc, the
corresponding codes are as follows:
s.expandtabs([tabsize])
a='aa\tbbbb\tc'
b=a.expandtabs()
Print(b)
bbbb
4-16
s.find(sub[,start[,end]])
s.index(sub[,start[,end]])
s.isalnum()
s.isalpha()
s.isdigit()
If all the characters in the string are digits and at least one
character exists in the string, True is returned. If any
character in the string is not a digit or no character exists in
the string, False is returned.
s.islower()
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
string is not lowercase or no letter exists in the string, False
is returned.
s.isspace()
If all the characters in the string are blank spaces and at least
a character exists in the string, True is returned. If any
character in the string is not a blank space or no letter exists
in the string, False is returned.
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Method
Description
s.istitle()
s.isupper()
s.join(seq)
s.ljust(width[,fillchar])
s.lower()
s.lstrip([char])
s.rindex(sub[,start[,end]])
s.rjust(width[,fillchar])
Issue 01 (20081208)
4-17
M2000
iSStar User Guide
4 HSL Reference
Method
Description
s.rsplit([sep [,maxsplit]])
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
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.
s.rstrip([char])
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
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.
s.split([sep [,maxsplit]])
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
deemed to delimit empty strings.
For example,
4-18
" '1, 2, 3'.split(', ') " returns " ['1', '2', '3'] ").
s.splitlines([keepends])
s.startswith(prefix [, start [,
end]])
s.strip([char])
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
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.
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Method
Description
s.swapcase()
s.title()
Returns title characters, that is, the initial letter of the copy
string and all the letters immediately following characters
other than letters should be changed to uppercase letters.
Letters in other positions are changed to lowercase letters.
s.translate(table [,delchars])
s.upper()
s.zfill(width)
Special Character
Special characters and their descriptions are listed in Table 4-9.
Table 4-9 Special Character
Name
Description
\\
Backslash
\'
\"
\a
Bell
\b
Space character
\e
Escape
\0
Null
\n
\v
Issue 01 (20081208)
4-19
M2000
iSStar User Guide
4 HSL Reference
Name
Description
\t
\r
\f
\OOO
octal(000-377)
\xhh
hex(x00-xff)
\un
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.
Table 4-10 Rule of escape characters
4-20
Character
Description
Unsigned integer
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
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.
Description
L.append(x)
L.extend(L1)
Adds elements in the L1 list at the end of the L list. It can also be
written as L[len(L):]. = L1, where L1 is a list.
L.insert(i,x)
L.remove(x)
L.pop([i])
L.index(x)
Returns the index value of the item whose first value is equal to x. If
x is not contained in L, then the execution of scripts may have errors.
L.count(x)
L.sort()
L.reverse()
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.
Tuple is displayed by (), for example, a=(0,1,2,3). The round brackets can be omitted.
Issue 01 (20081208)
4-21
M2000
iSStar User Guide
4 HSL Reference
l
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.
Table 4-12 Operations on dictionary objects
Operation
Description
dic2["key"]
Index.
dic3["key1"]["key2"]
Index.
key in dic
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 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 value of the dic, the result is False. (For details, see Example
2 in, not in.)
len(dic)
Gets the length of dic. (For details, see Example 3 Get the length
of the dic by the function len()..)
4-22
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Print("dic2['food']['ham'] = " + str(dic2['food']['ham']) )
Print("----------------------------")
#Change the value correspond to "sun" in dic1.
dic1['sun'] = 42
#Output the modified dic1.
Print("dic1 = " + str(dic1) )
Result
{'sun': 1, 'moon': 2}
{'food': {'egg': 2, 'ham': 1}}
---------------------------dic1['moon'] = 2
dic2['food']['ham'] = 1
---------------------------dic1 = {'sun': 42, 'moon': 2}
Result
True
False
Result
2
Description
dic .clear()
Clears dic.
dic.values()
dic.has_key(k)
dic.copy()
dic.items()
dic.keys()
Issue 01 (20081208)
4-23
M2000
iSStar User Guide
4 HSL Reference
Method
Description
dic.update([b])
dic.fromkeys(seq[,value])
dic.setdefault(k[,x])
dic.get(k[,x])
dic.pop(k[,x])
dic.popitem()
Returns the first key value pair (key, value) in dic, and then
deletes the pair.
dic.iteritems()
Returns the iterator of the key value pair (key, value) in dic.
dic.iterkeys()
dic.itervalues()
4.2.4 File
This section describes a file which provides basic operations for files, such as, opening, reading,
and writing files.
4-24
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Description
Open(filename[,mode[,bufsize]])
0 means unbuffered.
Description
close()
flush()
Clears the internal buffer. For some file objects, this function
may have no operation effect.
Issue 01 (20081208)
4-25
M2000
iSStar User Guide
4 HSL Reference
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])
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])
truncate([size])
4-26
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Mame
Description
write(str)
writelines(sequence)
closed
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
# Read the file data by line
def readLine ( filePath )
# Open the file in read-only mode
f = Open( filePath, "r")
line = f.readline()
buf = line
while line
#Print(c)
line = f.readline()
buf = buf + line
end
f.close()
return buf
end
# Read multiple lines of the file once
def readLines( filePath )
f = Open( filePath, "r")
lineList = f.readlines()
f.close()
return lineList
end
# Write the content in the file
def writeString ( aString , filePath )
f = file(filePath,'a+')
f.write(aString)
f.close()
end
Issue 01 (20081208)
4-27
M2000
iSStar User Guide
4 HSL Reference
# Write multiple lines in the file
def writeLines( strList , filePath )
f = file(filePath,'a+')
f.writelines(strList)
f.close()
end
filePath = "c:\\outfile.txt"
#Create a file
fp = Open(filePath, "w+")
fp.write("Hello World!\nNice to meet you.")
fp.close()
ret = readBytes( filePath )
Print("The result of reading the file by byte:" )
Print(ret)
ret = readLine( filePath )
Print("The result of reading the file by line: " )
Print(ret)
ret = readLines( filePath )
for line in ret
Print("The result of reading multiple lines of the file: " )
Print(line)
end
# Write the content to the end of the file
str = "test write"
writeString( str , filePath)
# Write multiple lines to the end of the file once
strList = [ 'line1 \n','line2 \n']
writeLines( strList , filePath)
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!
The result of reading multiple lines of the file:
Nice to meet you.
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Description
abs(x)
cmp(x,y)
coerce(x,y)
complex(real [, imag])
divmod(a,b)
len(s)
pow(x, y [, z])
round(num)
Related Instances
Issue 01 (20081208)
4-29
M2000
iSStar User Guide
4 HSL Reference
Description
float(x)
hex(x)
int(x [, base])
list(s)
long(x [, base])
oct(x)
ord(c)
chr(i)
repr(object)
str(object)
tuple(s)
Related Instances
4-30
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Description
unichr(i)
unicode(string[,encoding[,errors]])
Description
range([start,]stop[,step])
Issue 01 (20081208)
4-31
M2000
iSStar User Guide
4 HSL Reference
Function
Description
Call(FileName)
Runs the .hsl file with the name FileName. The running
results are as follows:
l
NOTE
For the files with no extension, process them as the script files.
Import(FileName)
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
Print("n2
Print("n3
Print("n4
Print("n5
Print("n6
4-32
=
=
=
=
=
=
"+str(n1))
"+str(n2))
"+str(n3))
"+str(n4))
"+str(n5))
"+str(n6))
Issue 01 (20081208)
M2000
iSStar User Guide
4 HSL Reference
Result
n1
n2
n3
n4
n5
n6
=
=
=
=
=
=
1
-1
(10+20j)
(1, 2)
9
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("long function convert a string or number to a long integer. ")
t4 = long(1)
Print(t4)
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)
Print("int function convert an string to a integer")
s = "11"
t7 = int(s)
t8 = int(s,2)
t9 = int(s,16)
Print(t7)
Print(t8)
Print(t9)
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
Issue 01 (20081208)
4-33
M2000
iSStar User Guide
4 HSL Reference
int function convert an string to a integer
11
3
17
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,
[0,
[0,
[0,
[]
[]
4-34
1, 2, 3, 4, 5, 6, 7, 8, 9]
2, 3, 4, 5, 6, 7, 8, 9, 10]
5, 10, 15, 20, 25]
3, 6, 9]
-1, -2, -3, -4, -5, -6, -7, -8, -9]
Issue 01 (20081208)
M2000
iSStar User Guide
5-1
M2000
iSStar User Guide
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.
5-2
Issue 01 (20081208)
M2000
iSStar User Guide
5-3
M2000
iSStar User Guide
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 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.
Table 5-1 lists the NE operation functions.
Table 5-1 List of NE operation functions
Function
5-4
Description
5.1.4 Function:
GetNELstByType
Issue 01 (20081208)
M2000
iSStar User Guide
Function
Description
5.1.12 Function:
GetMMLReport
5.1.13 Function:
GetAllMMLReport
5.1.14 Function:
ClearMMLBuffer
5.1.15 Function:
SetMMLBufferSize
Procedure
Figure 5-1 shows how to use NE operation functions to manage NEs.
Figure 5-1 Procedure for using NE operation functions
5-5
M2000
iSStar User Guide
1.
Select an NE.
Select the required NE by referring to 5.1.2 Function: ConnectNE. After this function is
called successfully, the corresponding task is created.
2.
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.
4.
5.
6.
Synopsis
ConnectNE(NEName)
Note
5-6
You must call this function to select the required NE. Then, after the operation is complete,
you can issue commands to the NE.
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.
You can select only the NEs that are properly connected to the M2000.
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
NEName
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)
# Exist if the connection failed.
if ret == 0
Print(' Failed to connect to %s.'%nename)
Exit(0)
end
# The connection is successful. Send an MML command.
@LST VER:;
NE
O&M
#41302
2007-06-21 19:38:43
%%/*415*/LST VER:;%%
RETCODE = 0
Execution succeeded.
Version information
------------------Product version
---
BSC6800V100R008ENGC01B080
END
Related Example
Issue 01 (20081208)
5-7
M2000
iSStar User Guide
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.
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()
# Print the names of all NEs.
Print('All NEs are:')
for ne in nelist
Print(ne)
end
Result
All NEs are:
rnc01
msc01
msc02
nodeb01
Related Example
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
GetNELstByType(NEType)
Note
None
Parameter Description
Parameter
NEType
Description
NEType is a string. It indicates the NE type.
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.
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.
Issue 01 (20081208)
5-9
M2000
iSStar User Guide
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")
#Get the name of the connected NE.
name = GetNEName()
Print("name: " + name)
Result
name: rnc001
Related Example
Synopsis
GetNEFDN([NEName])
Note
None.
Parameter Description
Parameter
NEName
5-10
Description
NEName is of string type. It indicates the name of an NE. The
default value is the name of the NE that is currently connected.
Issue 01 (20081208)
M2000
iSStar User Guide
Return Value
The return value is a string.
l
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")
#Get the FDN of the connected NE.
fdn = GetNEFDN()
Print("FDN: " + fdn)
Result of Example 1
fdn: .0.1.177
Example 2
#Get the FDN of the NE rnc001.
fdn = GetNEFDN("rnc001")
Print("FDN: " + fdn)
Result of Example 2
fdn: .0.1.177
Related Example
Synopsis
GetNEIP([NEName])
Issue 01 (20081208)
5-11
M2000
iSStar User Guide
Note
None.
Parameter Description
Parameter
NEName
Description
NEName is a string. It indicates the name of an NE. The default
value is the name of the NE that is currently connected.
Return Value
The return value is a string.
l
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")
#Get the IP address of the connected NE.
ip = GetNEIP()
Print("IP: " + ip)
Result of Example 1
ip: 200.200.200.200
Example 2
#Get the IP address of the connected NE.
ip = GetNEIP("rnc001")
Print("IP: " + ip)
Result of Example 2
ip: 200.200.200.200
Related Example
5-12
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
GetNEVer([NEName])
Note
None
Parameter Description
Parameter
NEName
Description
NEName is a string. It indicates the name of an NE. The default
value is the name of the NE that is currently connected.
Return Value
The return value is a string.
l
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")
#Get the version number of the NE.
neVer = GetNEVer()
Print('GetNEVer() return: ')
Print(neVer)
Result of Example 2
GetNEVer() return:
BSCNEV100R006ENGC01B071
Issue 01 (20081208)
5-13
M2000
iSStar User Guide
Related Example
Synopsis
GetNEType([NEName])
Note
None
Parameter Description
Parameter
NEName
Description
NEName is a string. It indicates the name of an NE. The default
value is the name of the NE that is currently connected.
Return Value
The return value is a string.
l
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")
#Get the NE type.
neType = GetNEType()
Print('GetNEType() return: ')
Print(neType)
5-14
Issue 01 (20081208)
M2000
iSStar User Guide
Result of Example 2
GetNEType() return:
RNC
Related Example
Synopsis
GetNEStatus([NEName])
Note
None
Parameter Description
Parameter
NEName
Description
NEName is a string. It indicates an NE name. The default value
is the name of the NE that is currently connected.
Return Value
The return value is an integer. If the NE is connected, 1 is returned. Otherwise, 0 is returned.
l
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")
#Get the status of the connected NE.
neStatus = GetNEStatus()
Print("neStatus: "+ str(neStatus))
Issue 01 (20081208)
5-15
M2000
iSStar User Guide
Result of Example 1
neStatus: 1
Example 2
#Get the status of the NE rnc001.
neStatus = GetNEStatus("rnc001")
Print("neStatus: "+ str(neStatus))
Result of Example 2
neStatus: 1
Related Example
Synopsis
SendMML(MMLCmd)
Note
Call 5.1.2 Function: ConnectNE to select the NE to be operated before calling this function.
Parameter Description
Parameter
MMLCmd
Description
MMLCmd is a string. It indicates the MML command string.
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.
5-16
Issue 01 (20081208)
M2000
iSStar User Guide
Result
SendMML("LST CELL:;") success.
300
300
301
302
302
5)
NodeB name
Local cell ID
Subrack No.
Subsystem
3812
3812
BBU
3812E
3812E
0
1
0
1
2
3
3
3
3
3
0
0
0
0
0
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.
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.
After a task is complete, the corresponding buffer is cancelled and the messages are deleted.
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.
Issue 01 (20081208)
5-17
M2000
iSStar User Guide
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
Idx
Description
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")
#Send MML commands continuously.
@LST OP:;
@LST CELL:;
@LST CELL:;
#Get the third message.
rpt1 = GetMMLReport(-1)
Print("The third report : ")
Print(rpt1)
#Get the first message.
rpt2 = GetMMLReport(0)
Print("The first report : ")
Print(rpt2)
Result
The third report :
+++
NE
2006-12-19 20:48:50
O&M
#8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
CELL1
1
1
CELL2
1
(Number of results = 2)
5-18
NodeB name
Local cell ID
Subrack No.
NODEB1
NODEB1
0
1
3
3
Issue 01 (20081208)
M2000
iSStar User Guide
---
END
Status
IP Address
admin
Online
10.161.24.166
GUEST
Offline NULL
(Number of results = 2)
---
Service
Login Time
10.161.24.166
NULL
2008-01-10 14:15:50
NULL
Service
Login Time
10.161.24.166
NULL
2008-01-10 14:15:50
NULL
END
Status
IP Address
admin
Online
10.161.24.166
GUEST
Offline NULL
(Number of results = 2)
---
END
+++
NE
2006-12-19 20:48:50
O&M
#8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
CELL1
1
1
CELL2
1
(Number of results = 2)
---
NodeB name
Local cell ID
Subrack No.
NODEB1
NODEB1
0
1
3
3
NodeB name
Local cell ID
Subrack No.
NODEB1
NODEB1
0
1
3
3
END
+++
NE
2006-12-19 20:48:50
O&M
#8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
CELL1
1
1
CELL2
1
(Number of results = 2)
Issue 01 (20081208)
5-19
M2000
iSStar User Guide
---
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.
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.
After a task is complete, the buffer is cancelled and the messages are deleted.
Parameter Description
None.
Return Value
l
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')
#Clear the MML messages in the buffer.
ClearMMLBuffer()
#Send MML commands continuously.
@@@
LST OP:;
LST CELL:;
@@@
#Get and clear the MML messages in the buffer.
allReport = GetAllMMLReport()
#Output the messages in the buffer.
5-20
Issue 01 (20081208)
M2000
iSStar User Guide
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
admin
Online
10.161.24.166
GUEST
Offline NULL
(Number of results = 2)
---
Service
Login Time
10.161.24.166
NULL
2008-01-10 14:15:50
NULL
END
Report = +++
NE
2006-12-19 20:48:50
O&M
#8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
CELL1
1
1
CELL2
1
(Number of results = 2)
---
NodeB name
Local cell ID
Subrack No.
NODEB1
NODEB1
0
1
3
3
END
Status
IP Address
admin
Online
10.161.24.166
GUEST
Offline NULL
(Number of results = 2)
---
Service
Login Time
10.161.24.166
NULL
2008-01-10 14:15:50
NULL
END
Report = +++
NE
2006-12-19 20:48:50
O&M
#8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
Issue 01 (20081208)
NodeB name
Local cell ID
Subrack No.
5-21
M2000
iSStar User Guide
0
CELL1
1
1
CELL2
1
(Number of results = 2)
---
NODEB1
NODEB1
0
1
3
3
END
Related Example
Synopsis
ClearMMLBuffer()
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.
The MML messages accumulates in the buffer. When the number of stored messages
exceeds the maximum, new messages are lost. Therefore, you need to clear the buffer of
MML messages in time.
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 NE ne1.
ConnectNE("ne1")
#Send MML commands continuously.@LST VER:;
@LST VER:;
returncode = ClearMMLBuffer()
Print('ClearMMLBuffer() return: ' + str(returncode))
Result
ClearMMLBuffer() return: 1
5-22
Issue 01 (20081208)
M2000
iSStar User Guide
END
LST VER:;
+++
NE
2007-03-26 20:32:25
O&M;
#31280
%%/*14263*/LST VER:;%%
RETCODE = 0 Execution succeeded.
---
END
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.
The messages accumulates in the buffer. When the number of stored messages exceeds the
maximum, new messages are lost.
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:
Len
Issue 01 (20081208)
When len is equal to -1, you can infer that all messages are allowed
in the buffer.
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.
5-23
M2000
iSStar User Guide
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')
#Set the size of the MML buffer to 2.
returncode = SetMMLBufferSize(1)
@@@
LST VER:;
LST VER:;
LST VER:;
@@@
mmllist = GetAllMMLReport()
Print('The number of mml reports is : %s'%str(len(mmllist)))
Result
The number of mml reports is : 1
UMG8900
O&M
#5852
2008-01-08 12:07:34
%%/*117775*/LST VER:;%%
RETCODE = 0
Execution succeeded.
Version information
-----------------------Product version = UMG8900V200R007C02B019
---
END
Related Example
Issue 01 (20081208)
M2000
iSStar User Guide
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")
# Get the ABC NE list.
neList = GetNELstByType("ABC")
Print("Print the obtained ABC NE list.")
Print(neList)
Print("")
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)
# Parse the message and isolate the messages in invalid format.
objNum = GetObjNum(mmlParser)
if objNum <> 2
Print("InvalidReport")
return False
end
# 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
Issue 01 (20081208)
5-25
M2000
iSStar User Guide
# 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
# Start performing the task.
SUCCESS = 1
# "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
Print("The routine health check ends.")
Result
Routine health check starts.
Print the obtained ABC NE list.
['NE203', ' NE 96', ' NE 99']
Checking the NE NE203.
Connecting NE NE203 failed.
Checking the NE NE96
Sending commands for query...
Check result
The free space of disk D:\ is 31%. The free space is insufficient. Please handle
it.
5-26
Issue 01 (20081208)
M2000
iSStar User Guide
harddisk
space(M)
space(M)
space(%)
=
=
=
=
D:\
9537
2961
31%
(Number of results = 2)
---
END
5-27
M2000
iSStar User Guide
This describes the GetReportDate function. This function enables you to obtain the creation date
of an MML message.
5.2.6 Function: GetReportTime
This describes the GetReportTime function. This function enables you to obtain the creation
time of an MML message.
5.2.7 Function: GetTimeAdjustFlag
This describes the GetTimeAdjustFlag function. This function enables you to get the time
adjustment flag of an alarm message. A time adjustment flag indicates a periodic adjustment of
time, for example, the DST. The M2000 can precisely determine the time with the help of this
flag.
5.2.8 Function: GetServiceFlag
This describes the GetService Flag function. This function enables you to obtain the MML
message service flag. A service flag is used for identifying the service types of a message, for
example, alarm message or performance message.
5.2.9 Function: GetReportIdx
This describes the GetReportIdx function. This function enables you to obtain the serial number
of an MML message. The message serial number maps a task. It uniquely identifies the output
message of a task.
5.2.10 Function: GetMMLCmd
This describes the GetMMLCmd function. This function enables you to obtain the echo of an
MML command. The command echo shows the MML commands that is issued.
5.2.11 Function: GetResultCode
This describes the GetResultCode function. This function enables you to obtain the return code
of an MML message. A return code identifies whether the NE system has successfully processed
the MML commands.
5.2.12 Function: GetResultCause
This describes the GetResultCause function. This function enables you to obtain the remarks of
the 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.
5.2.13 Function: GetObjNum
This describes the GetObjNum function. This function enables you to obtain the number of
entries in an MML message.
5.2.14 Function: GetObjTitle
This describes the GetObjTitle function. This function enables you to obtain the title of the
specified entry in an MML message. A title summarizes the contents of a message entry.
5.2.15 Function: GetRecordNum
This describes the GetRecordNum function. This function enables you to obtain the number of
records in the specified entry in an MML message.
5.2.16 Function: GetTips
This describes the GetTips function. This function enables you to obtain the tips of an MML
messageFor some commands, you need to provide detailed explanations in the form of tips
for integrity purpose.
5.2.17 Function: GetAttrValueByName
This describes the GetAttrValueByName function. This function enables you to obtain the
specified attribute value from a parsed MML message according to the entry number, attribute
name, and record number.
5-28
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Issue 01 (20081208)
5-29
M2000
iSStar User Guide
Description
Parses MML message strings.
Returns the source identifier of an MML message.
5.2.7 Function:
GetTimeAdjustFlag
5-30
Issue 01 (20081208)
M2000
iSStar User Guide
FunctiPon
Description
Returns the return codes of an MML message.
5.2.17 Function:
GetAttrValueByName
5.2.18 Function:
GetAttrValueByIdx
5.2.19 Function:
GetAttrNameList
Issue 01 (20081208)
5-31
M2000
iSStar User Guide
FunctiPon
Description
5.2.21 Function:
GetColumnByName
5.2.22 Function:
GetColumnByIndex
5.2.24 Function:
GetDataFrmMMLRpt
5.2.25 Function:
DestroyMMLParser
Procedure
Figure 5-2 shows how to use the MML message parsing functions to obtain the message
contents.
Figure 5-2 Workflow of MML message parsing functions
5-32
Issue 01 (20081208)
M2000
iSStar User Guide
2.
3.
Field Meaning
Description
(1)
Start identifiers of an
MML message.
Issue 01 (20081208)
5-33
M2000
iSStar User Guide
SN
Field Meaning
Description
(2)
Source identity
(equipment
identification).
(3)
(4)
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.
O&M
Operation and maintenance report. All session
outputs, for example, service configuration and
alarm query, belong to the O&M type.
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.
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.
Serial number.
5-34
Issue 01 (20081208)
M2000
iSStar User Guide
SN
Field Meaning
Description
(7)
Command echo.
(8)
Return code.
(9)
(10)
(11)
Attribute of entry 0.
(12)
(13)
Entry 0.
Record 1 of entry 0.
(15)
(16)
Entry 1.
(17)
Issue 01 (20081208)
End identifier.
5-35
M2000
iSStar User Guide
SN
Field Meaning
Description
(18)
MML message.
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.
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.
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
The return value of the ParseMMLRpt function is the parsing object of the MML message. The
parsing object of the MML message is necessary for other message parsing functions. Therefore,
you need to call this function before calling other message parsing functions.
5-36
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
MMLRpt
Return Value
If the function is called successfully, the MML message parsing object is returned. Otherwise,
None 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
ConnectNE("NE001")
@LST VER:;
mml = GetMMLReport()
# Parse the MML message.
p = ParseMMLRpt(mml)
returnCode = GetResultCode(p)
Print('The returncode of the MML command is %s'%returnCode)
Result
The returncode of the MML command is 0
END
Related Example
5-37
M2000
iSStar User Guide
Synopsis
GetSourceName(pMMLRpt)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
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
admin
online 10.161.37.211
guest
online 10.161.37.211
((Result number = 2 ))
--END
'''
p = ParseMMLRpt(mml)
sourceName = GetSourceName(p)
Service
10.161.37.211---O&M System
10.161.37.211---O&M System
Login Time
2006-09-06 16:46:36
2006-09-06 16:47:49
Result
GetSourceName() return: NE
Related Example
5-38
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
GetReportDate(pMMLRpt)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
Parameter
Description
pMMLRpt
Return Value
Error Handling
Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function:
GetErrorMsg.
Example
mml = '''
+++
2007-06-21 11:34:08
O&M
#21894
%%/*8221*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
0
1
1
20
20
11
11
12
12
(Number of results =
--'''
300
300
301
302
302
5)
NodeB name
3812
3812
BBU
3812E
3812E
Local cell ID
0
1
0
1
2
Subrack No.
3
3
3
3
3
Subsystem No.
0
0
0
0
0
END
p = ParseMMLRpt(mml)
Issue 01 (20081208)
5-39
M2000
iSStar User Guide
Result
GetReportDate() return: 2007-06-21
Related Example
Synopsis
GetReportTime(pMMLRpt)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
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
--'''
5-40
END
Issue 01 (20081208)
M2000
iSStar User Guide
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
pMMLRpt
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.
Issue 01 (20081208)
5-41
M2000
iSStar User Guide
CELL1
1
CELL2
1
CELL3
1
CELL4
1
CELL5
2
CELL6
2
CELL7
2
CELL10
1
of results = 8)
NodeB name
NODEB1
NODEB1
NODEB1
NODEB1
NODEB2
NODEB2
NODEB2
NODEB1
Local cell ID
0
1
2
3
4
5
6
10
3
3
3
3
3
3
3
3
Subrack No.
0
0
0
0
0
0
0
0
Subsystem No.
DL primary sc
0
128
127
126
125
124
123
1
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
pMMLRpt
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.
The meanings of the service report flags are as follows:
l
5-42
TRAFFIC
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
Issue 01 (20081208)
M2000
iSStar User Guide
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.
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.
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
20
10
12
15
(Number
--"""
0
300
1
300
20
301
10
302
12
302
3802
3802
of results = 6)
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
END
p = ParseMMLRpt(mml)
#Get and output the service message flag.
Print("GetServiceFlag() : "+ str(GetServiceFlag(p)))
Result
GetServiceFlag(): O&M
Related Example
5-43
M2000
iSStar User Guide
Synopsis
GetReportIdx(pMMLRpt)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
20
10
12
15
(Number
--"""
0
300
1
300
20
301
10
302
12
302
3802
3802
of results = 6)
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
END
5-44
Issue 01 (20081208)
M2000
iSStar User Guide
Result
GetReportIdx() : 71476
Related Example
Synopsis
GetMmlCmd(pMMLRpt)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
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.
ALARM
67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Issue 01 (20081208)
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
5-45
M2000
iSStar User Guide
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(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
pMMLRpt
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.
5-46
Issue 01 (20081208)
M2000
iSStar User Guide
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
20
10
12
15
(Number
--"""
0
300
1
300
20
301
10
302
12
302
3802
3802
of results = 6)
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
END
Result
GetResultCode() return: 0
Related Example
Synopsis
GetResultCause(pMMLRpt)
Note
None
Issue 01 (20081208)
5-47
M2000
iSStar User Guide
Parameter Description
Parameter
Description
pMMLRpt
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
20
10
12
15
(Number
--"""
0
300
1
300
20
301
10
302
12
302
3802
3802
of results = 6)
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
END
Result
GetResultCause() return: Execution succeeded.
Related Example
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
GetObjNum(pMMLRpt)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
12
15
(Number
--"""
0
300
1
300
12
302
3802
3802
of results = 4)
3812
3812
3812E
3802
0
1
2
0
3
3
3
3
0
0
0
0
END
Result
GetObjNum() return: 1
Related Example
Issue 01 (20081208)
5-49
M2000
iSStar User Guide
Synopsis
GetObjTitle(pMMLRpt, ObjIndex)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
ObjIndex
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
20
10
12
15
(Number
--"""
5-50
0
300
1
300
20
301
10
302
12
302
3802
3802
of results = 6)
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
END
Issue 01 (20081208)
M2000
iSStar User Guide
Result
GetObjTitle() return: List cell basic information
Related Example
Synopsis
GetRecordNum(pMMLRpt, ObjIndex)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
ObjIndex
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.
Issue 01 (20081208)
5-51
M2000
iSStar User Guide
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
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
pMMLRpt
Description
pMMLRpt indicates a parsed MML message object.
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.
5-52
Issue 01 (20081208)
M2000
iSStar User Guide
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
20
10
12
15
(Number
0
300
1
300
20
301
10
302
12
302
3802
3802
of results = 6)
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
Hints
----some words
--'''
END
p = ParseMMLRpt(mml)
Print("GetTips() return: "+ str(GetTips(p)))
Result
GetTips() return: some words
Related Example
Synopsis
GetAttrValueByName(pMMLRpt, ObjIndex, PropName, RecordIdx,Case = 0)
Note
None
Issue 01 (20081208)
5-53
M2000
iSStar User Guide
Parameter Description
Parameter
Description
pMMLRpt
ObjIndex
PropIndex
RecordIdx
Case
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
0
300
1
1
300
20
20
301
10
10
302
12
12
302
15
3802
3802
(Number of results = 6)
--'''
NodeB name
3812
3812
BBU
3812E
3812E
3802
END
p = ParseMMLRpt(mml)
5-54
Issue 01 (20081208)
M2000
iSStar User Guide
Result
GetAttrValueByName() = 1
Related Example
Synopsis
GetAttrValueByIdx(pMMLRpt, ObjIndex, PropIndex, RecordIdx)
Note
None
Parameter Description
Parameter
Description
pMMLRpt
ObjIndex
PropIndex
RecordIdx
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.
Issue 01 (20081208)
5-55
M2000
iSStar User Guide
Example
mml = '''
+++
NE
2007-12-07 10:13:53
O&M
#243
%%/*617*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No.
0
1
20
10
12
15
(Number
--'''
0
300
1
300
20
301
10
302
12
302
3802
3802
of results = 6)
3812
3812
BBU
3812E
3812E
3802
0
1
0
0
2
0
3
3
3
3
3
3
0
0
0
0
0
0
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
5-56
Description
pMMLRpt
ObjIndex
Issue 01 (20081208)
M2000
iSStar User Guide
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.
List BAM IP route
----------------Destination network address
10.20.0.0
10.21.0.0
(Number of results = 2)
--'''
255.255.0.0
255.255.0.0
10.121.143.208
10.121.143.208
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
Issue 01 (20081208)
5-57
M2000
iSStar User Guide
Parameter Description
Parameter
Description
pMMLRpt
ObjIndex
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.
List board type
--------------Subrack No. = 5
Slot No. = 0
Board type = WOSE
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
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
GetColumnByName(mParser, objIndex, columnName, ignoreCase)
Note
None.
Description
Parameter
Description
mParser
objIndex
columnName
ignoreCase
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
1
2
3
4
5
6
Issue 01 (20081208)
CELL1
CELL2
CELL3
CELL4
CELL5
CELL6
CELL7
1
1
1
1
2
2
2
NodeB name
NODEB1
NODEB1
NODEB1
NODEB1
NODEB2
NODEB2
NODEB2
0
1
2
3
4
5
6
Local cell ID
3
3
3
3
3
3
3
Subrack No.
0
0
0
0
0
0
0
Subsystem No.
DL primary sc
0
128
127
126
125
124
123
5-59
M2000
iSStar User Guide
NODEB1
10
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
mParser
objIndex
columnIndex
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.
5-60
Issue 01 (20081208)
M2000
iSStar User Guide
Error Handling
None.
Example
mml = """
+++
RNC
2006-12-19 20:48:50
O&M
#8522
%%/*2116*/LST CELL:;%%
RETCODE = 0 Execution succeeded.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
1
2
3
4
5
6
10
(Number
--"""
CELL1
1
CELL2
1
CELL3
1
CELL4
1
CELL5
2
CELL6
2
CELL7
2
CELL10
1
of results = 8)
NodeB name
NODEB1
NODEB1
NODEB1
NODEB1
NODEB2
NODEB2
NODEB2
NODEB1
Local cell ID
0
1
2
3
4
5
6
10
3
3
3
3
3
3
3
3
Subrack No.
0
0
0
0
0
0
0
0
Subsystem No.
DL primary sc
0
128
127
126
125
124
123
1
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.
Issue 01 (20081208)
5-61
M2000
iSStar User Guide
Description
Parameter
Description
mParser
objIndex
rowIndex
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.
List cell basic information
--------------------------Cell ID Cell name NodeB ID
0
1
2
3
4
5
6
10
(Number
--"""
CELL1
1
CELL2
1
CELL3
1
CELL4
1
CELL5
2
CELL6
2
CELL7
2
CELL10
1
of results = 8)
NodeB name
NODEB1
NODEB1
NODEB1
NODEB1
NODEB2
NODEB2
NODEB2
NODEB1
0
1
2
3
4
5
6
10
Local cell ID
3
3
3
3
3
3
3
3
Subrack No.
0
0
0
0
0
0
0
0
Subsystem No.
DL primary sc
0
128
127
126
125
124
123
1
END
p = ParseMMLRpt(mml)
row = GetRowByIndex(p, 0, 0)
for v in row
Print(v)
end
Result
0
CELL1
5-62
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
GetDataFrmMMLRpt(mParser, objIndex, columnIndexList)
Note
None
Parameter Description
Parameter
Description
mParser
objIndex
columnIndexList
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:;%%
Issue 01 (20081208)
5-63
M2000
iSStar User Guide
Execution succeeded.
CELL1
1
CELL2
1
CELL3
1
CELL4
1
CELL5
2
CELL6
2
CELL7
2
CELL10
1
of results = 8)
NodeB name
NODEB1
NODEB1
NODEB1
NODEB1
NODEB2
NODEB2
NODEB2
NODEB1
0
1
2
3
4
5
6
10
Local cell ID
3
3
3
3
3
3
3
3
Subrack No.
0
0
0
0
0
0
0
0
Subsystem No.
DL primary sc
0
128
127
126
125
124
123
1
END
p = ParseMMLRpt(mml)
title, data = GetDataFrmMMLRpt(p, 0)
Print(title)
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
5-64
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
DestroyMMLParser(mparser)
Issue 01 (20081208)
5-65
M2000
iSStar User Guide
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
mparser
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.
5-66
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.
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
Issue 01 (20081208)
M2000
iSStar User Guide
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.
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
Print('Starting to check the NE. Please wait...')
@LST FRM:;
mml = GetMMLReport(-1)
parser = ParseMMLRpt(mml)
# 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
# Get the subrack list.
frame_list = GetColumnByIndex(parser, 0, 0)
# Create a report and add a page about subrack information.
NewReport()
sId = AddNewSheet('subrack information')
# Searching for all the subrack information cyclically.
for frmNo in frame_list
@DSP FRM: FN=%frmNo%;
mml = GetMMLReport(-1)
# Parse the returned message.
parser = ParseMMLRpt(mml)
# 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)
# Convert the two-dimensional list into a one-dimensional list.
dataset = []
for r in tb
dataset += r
end
# Set the data to the table.
SetTableValue(tId, dataset)
end
Issue 01 (20081208)
5-67
M2000
iSStar User Guide
Result
*************Subrack status check starts *************
Starting to check the NE. Please wait...
*************The subrack status check ends*************
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.
Figure 5-4 Elements in the report
Issue 01 (20081208)
M2000
iSStar User Guide
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
Issue 01 (20081208)
5-69
M2000
iSStar User Guide
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.
5-70
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Table 5-4 Alarm message parsing function list
Function
Description
Issue 01 (20081208)
5-71
M2000
iSStar User Guide
Function
Description
5-72
Issue 01 (20081208)
M2000
iSStar User Guide
Function
Description
Issue 01 (20081208)
5-73
M2000
iSStar User Guide
Function
Description
Procedure
Figure 5-5 shows how to use the alarm message parsing functions to obtain the alarm message
contents.
Figure 5-5 Workflow of alarm message parsing functions
5-74
Issue 01 (20081208)
M2000
iSStar User Guide
2.
3.
A head marks the starting of an alarm message. It defines the start mark as well as the source
identity, service message flag, serial number, creation time, command echo, return code,
and return code explanation. These points are the common features of MML messages and
are processed primarily when the system identifies an MML message.The head structure
of an alarm message is the same as that of an MML message. The MML message head
parsing function is also applicable for parsing alarm messages.
A body is the main part of the alarm message. It contains all the information to be
transmitted in the message.
An end identifier represents the end of the alarm message. It is used together with the start
identifier to identify an alarm message.
The alarm in an alarm message, that is, the message body is composed of the following
items: basic attributes, alarm synchronization number, alarm name, generation time, and
alarm location information. Some alarms may also contain alarm details, alarm cause,
handling suggestion, restoration type, and restoration time.
The basic alarm attributes include service message identity, flow number, alarm type, alarm
severity, NE type, alarm ID, and alarm class.
Figure 5-6 shows the format of an alarm message. For details of Figure 5-6, see Table 5-5.
Figure 5-6 Alarm Message Format
Issue 01 (20081208)
5-75
M2000
iSStar User Guide
Field Meaning
Description
(1)
Start identifier
(2)
Source identity
(equipment
identification)
(3)
Creation time
(4)
(5)
Serial number
(6)
Command echo of an
MML command in
an alarm message
(7)
Return code
(8)
Remarks of a return
code
5-76
(9)
(10)
Flow number of
alarm 0
(11)
Alarm category of
alarm 0
(12)
Alarm severity of
alarm 0
Issue 01 (20081208)
M2000
iSStar User Guide
SN
Field Meaning
Description
(13)
NE type of alarm 0
(14)
Alarm ID of alarm 0
(15)
Power system
Environment system
Signaling system
Relay system
Hardware system
Software system
Running system
Communications system
QoS
Handling error
Internal NM system
Basic attributes of an
alarm
(17)
Attribute name
(18)
Attribute value
(19)
Alarm
synchronization No.
(20)
Alarm name
Issue 01 (20081208)
5-77
M2000
iSStar User Guide
SN
Field Meaning
Description
(21)
Alarm generation
time
(22)
Alarm location
information
(23)
Entry 0
(24)
Entry 1
Alarm 1
(25)
Entry 2
Alarm 2
(26)
End identifier
(27)
Alarm message
CAUTION
The indexes of entries, attributes, and records of an alarm message count from 0.
Synopsis
ParseAlmRpt(AlmRpt)
5-78
Issue 01 (20081208)
M2000
iSStar User Guide
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
AlmRpt
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 4)
--"""
Issue 01 (20081208)
END
5-79
M2000
iSStar User Guide
Result
ParseAlmRpt(strAlarm) return: <AlarmParser.AlarmParser instance at 0x0A4BB508>
Related Example
Synopsis
GetAlmSource(pAlmRpt)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
5-80
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
Issue 01 (20081208)
M2000
iSStar User Guide
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
Result
Alarm source is:NE
Related Example
Synopsis
GetAlmRptDate(pAlmRpt)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
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.
Issue 01 (20081208)
5-81
M2000
iSStar User Guide
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
Result
The create date of an alarm report is: 2006-01-04
Related Example
Synopsis
GetAlmRptTime(pAlmRpt)
Note
None.
5-82
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
pAlmRpt
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
Result
The generation time of an alarm message is: 11:35:56
Related Example
Issue 01 (20081208)
5-83
M2000
iSStar User Guide
Synopsis
GetAlmRptNum(pAlmRpt)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
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.
ALARM
67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
ALARM
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
5-84
211
Hardware
Issue 01 (20081208)
M2000
iSStar User Guide
END
Result
The number of alarm reports is: 3
Related Example
Synopsis
GetAlmServiceTag(pAlmRpt, Index)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
Index
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 = """
Issue 01 (20081208)
5-85
M2000
iSStar User Guide
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(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
pAlmRpt
5-86
Description
pAlmRpt indicates the parsing object of the alarm message.
Issue 01 (20081208)
M2000
iSStar User Guide
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
pAlmRpt
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.
ALARM
67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Issue 01 (20081208)
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
5-87
M2000
iSStar User Guide
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
p = ParseAlmRpt(strAlarm)
#Get the service message flag of the alarm message.
fl = GetAlmServiceFlag(p)
Print('The alarm service flag is: ' + fl)
Result
The alarm service flag is: ALARM
Related Example
Synopsis
GetAlmRptIdx(pAlmRpt)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
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.
5-88
Issue 01 (20081208)
M2000
iSStar User Guide
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
Result
The index of the alarm report is: 27232
Related Example
Synopsis
GetAlmMMLCmd(pAlmRpt)
Issue 01 (20081208)
5-89
M2000
iSStar User Guide
Note
None
Parameter Description
Parameter
pAlmRpt
Description
pAlmRpt indicates a parsed alarm message object.
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
5-90
Issue 01 (20081208)
M2000
iSStar User Guide
Result
GetAlmMMLCmd(p) return: LST ALMAF: CNT=0;
Related Example
Synopsis
GetAlmResultCode(pAlmRpt)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM
Issue 01 (20081208)
68046
Fault
Major
RNC
211
1802
Hardware
Signaling
5-91
M2000
iSStar User Guide
=
=
=
=
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(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
pAlmRpt
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.
5-92
Issue 01 (20081208)
M2000
iSStar User Guide
Example
strAlarm = """
+++
NE
2006-01-04 11:35:56
ALARM
#27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
Result
The information about the return code of an alarm message is: Execution succeeded.
Related Example
Synopsis
GetAlmTips(pAlmRpt)
Note
None
Issue 01 (20081208)
5-93
M2000
iSStar User Guide
Parameter Description
Parameter
pAlmRpt
Description
pAlmRpt indicates the parsing object of the alarm message.
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
pAlmRpt
Index
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.
5-94
Issue 01 (20081208)
M2000
iSStar User Guide
Example
strAlarm = """
+++
NE
2006-01-04 11:35:56
ALARM
#27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
p = ParseAlmRpt(strAlarm)
# Get the flow number of alarm 0.
fl = GetAlmFlowNumber(p, 0)
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
Issue 01 (20081208)
5-95
M2000
iSStar User Guide
Parameter Description
Parameter
Description
pAlmRpt
Index
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
p = ParseAlmRpt(strAlarm)
#Get the alarm type of alarm 0.
alarmtype = GetAlmType(p, 0)
Print('The alarm type of the specified alarm is: ' + alarmtype)
5-96
Issue 01 (20081208)
M2000
iSStar User Guide
Result
The alarm type of the specified alarm is: Fault
Related Example
Synopsis
GetAlmLevel(pAlmRpt,Index)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
Index
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Issue 01 (20081208)
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
5-97
M2000
iSStar User Guide
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
p = ParseAlmRpt(strAlarm)
# Get the alarm severity of alarm 0.
almLevel = GetAlmLevel(p, 0)
Print('The severity of the Index alarm is: ' + almLevel)
Result
The severity of the Index alarm is: Major
Related Example
Synopsis
GetAlmNEType(pAlmRpt,Index)
Note
None
Parameter Description
5-98
Parameter
Description
pAlmRpt
Index
Issue 01 (20081208)
M2000
iSStar User Guide
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
p = ParseAlmRpt(strAlarm)
# Get the NE type of alarm 0.
netype = GetAlmNEType(p, 0)
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
5-99
M2000
iSStar User Guide
Synopsis
GetAlmID(pAlmRpt,Index)
Note
None
Parameter Description
Parameter
Description
pAlmRpt
Index
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.
ALARM
67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
ALARM
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
211
Hardware
(Number of results = 3)
5-100
Issue 01 (20081208)
M2000
iSStar User Guide
--"""
END
p = ParseAlmRpt(strAlarm)
# Get the alarm ID of alarm 1.
almId = GetAlmID(p,1)
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
pAlmRpt
Index
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.
Issue 01 (20081208)
5-101
M2000
iSStar User Guide
Example
strAlarm = """
+++
NE
2006-01-04 11:35:56
ALARM
#27232
%%LST ALMAF: CNT=0;%%
RETCODE = 0 Execution succeeded.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
p = ParseAlmRpt(strAlarm)
sort = GetAlmSort(p, 0)
Result
The alarm sort of the specified alarm is: Hardware
Related Example
Synopsis
GetAlmSyncSerialNo(pAlmRpt,Index)
Note
None
5-102
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
pAlmRpt
Index
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
p = ParseAlmRpt(strAlarm)
serial = GetAlmSyncSerialNo(p, 1)
Print("The alarm's sync serial No. of the 1st alarm is: " + serial)
Issue 01 (20081208)
5-103
M2000
iSStar User Guide
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
pAlmRpt
Index
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
5-104
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
Issue 01 (20081208)
M2000
iSStar User Guide
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(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
pAlmRpt
Index
Issue 01 (20081208)
5-105
M2000
iSStar User Guide
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
' + rtime)
Result
The raising time of the Index alarm is:
2005-12-27 15:06:50
Related Example
Issue 01 (20081208)
M2000
iSStar User Guide
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
pAlmRpt
Index
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.
ALARM
67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
ALARM
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
ALARM
68046
Fault
Major
Sync serial No. = 110154
Issue 01 (20081208)
RNC
211
1802
Hardware
Signaling
5-107
M2000
iSStar User Guide
=
=
=
(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
5-108
Parameter
Description
pAlmRpt
Index
PropName
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter
Description
Case
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.
ALARM
67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
ALARM
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
211
Hardware
(Number of results = 3)
--"""
END
Issue 01 (20081208)
5-109
M2000
iSStar User Guide
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
pAlmRpt
Index
PropIndex
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.
ALARM
5-110
67984
Fault
Major
RNC
211
Hardware
Issue 01 (20081208)
M2000
iSStar User Guide
=
=
=
=
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(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
pAlmRpt
Level
Issue 01 (20081208)
5-111
M2000
iSStar User Guide
Parameter
Description
Case
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.
ALARM 67984
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
5-112
Issue 01 (20081208)
M2000
iSStar User Guide
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
pAlmRpt
Start
Stop
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.
ALARM
Issue 01 (20081208)
67984
Fault
Major
RNC
211
Hardware
5-113
M2000
iSStar User Guide
=
=
=
=
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
Result
The number of alarms in a specified period is: 1
Related Example
5-114
Issue 01 (20081208)
M2000
iSStar User Guide
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 4)
--END
"""
showAlmInfoByIndex(strAlarm, 0)
Result
The
The
The
The
Issue 01 (20081208)
Major
RNC
110134
WGRU Board Not in Position
2005-12-27 15:06:50
Subrack No.=3, Slot No.=8
211
Hardware
5-115
M2000
iSStar User Guide
ALARM 68037
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110145
SAAL Link Unavailable
2005-12-27 15:07:23
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=2, Cause=Unknown Cause.
ALARM 68046
Fault
Sync serial No. =
Alarm name =
Alarm raised time =
Location info =
Major
RNC
1802
Signaling
110154
SAAL Link Unavailable
2005-12-27 15:07:27
Subrack No.=3, Slot No.=10, Subsystem No.=0, SAAL link
No.=0, Cause=Unknown Cause.
(Number of results = 3)
--"""
END
Result
An Major alarm
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Issue 01 (20081208)
5-117
M2000
iSStar User Guide
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.
5-118
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Table 5-6 lists the database operation functions.
Table 5-6 Database operation function list
Function
Description
5.4.12 Function:
GetIntegrityReportCond
5.4.13 Function:
GetFunctionSubSetList
Issue 01 (20081208)
5-119
M2000
iSStar User Guide
Function
Description
5.4.23 Function:
GetMocAttrNameList
5.4.28 Function:
GetFuncSubSetList
5.4.29 Function:
GetMoiAttrValueList
Procedure
Figure 5-7 shows how to use the database operation functions.
5-120
Issue 01 (20081208)
M2000
iSStar User Guide
2.
3.
4.
5.
Issue 01 (20081208)
5-121
M2000
iSStar User Guide
Synopsis
OpenDB(UserName, Password)
Note
None
Parameter Description
Parameter
Description
UserName
Password
NOTE
If the user name and password are not entered, the database is accessed through the current client
login user and password.
If the user name and password are entered, the database is accessed through the entered user name
and password.
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
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
CreateCond(ENUM)
Note
None
Parameter Description
Name
ENUM
Description
The ENUM type is enumeration. It is the basis for creating objects
of condition objects.
ENUM = {
FM_COND,
PM_COND,
CM_COND
}.
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")
#Create an object of alarm query condition.
fmcond = CreateCond(FM_COND)
#Set the time segment for alarm query.
fmcond[START_TIME] = (2006, 12, 29, 18, 24, 39)
fmcond[END_TIME] = (2006, 12, 30, 10, 20, 40)
#Query the alarms that meet the condition and output the number of alarm records.
returncode = QueryFmRcds(fmcond)
Print('QueryFmRcds() return: ' + str(returncode))
#Get the alarm records queried by the QueryFmRcds function.
FmRecords = NextFmRcds()
#Close the database connection.
CloseDB()
Issue 01 (20081208)
5-123
M2000
iSStar User Guide
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.
Call the function OpenDB to connect to the database before calling this function.
Parameter Description
Parameter
Fmcond
Description
Fmcond is the query condition object. It is the return value of
calling CreateCond(FM_COND)).
Items of Fmcond are enumeration values. The items are:
{RESULT_SORT, ALARM_CATE, TIME_MODE,
START_TIME, END_TIME, ALARMINFO_SEQ,
NEFDN_SEQ, ALARMCAUSE_SEQ,
ALARMLEVEL_SEQ, ALARMSTATUS_SEQ,
LINKFDN_SEQ, IDENTIF_SEQ}. For details of meanings for
the items, refer to Table 5-7.
RESULT_SORT
5-124
Detailed Information
Sorts the results. You can set
the item by using Fmcond
[RESULT_SORT]. Fmcond
[RESULT_SORT] is a tuple
containing the element
(OrderItem, OrderType). The
default value is (0, 1).
OrderItem: is an integer. It
indicates the field by which
the results are sorted. The
values and meanings are as
follows:
l 0: not sort
l
2: sort by NEFDN
Issue 01 (20081208)
M2000
iSStar User Guide
Enumerated Type
Detailed Information
l
l
l
6: sort by acknowledge
status
9: sort by NEType
l
l
Ordertype: is an integer. It
indicates the field by which
the results are sorted. The
values and meanings are as
follows:
l 1: ascending order
l
ALARM_CATE
TIME_MODE
2: descending order
2: event alarm
1: NE time mode
NOTE
If you do not set Fmcond
[TIME_MODE], the default
value is 1.
START_TIME
Issue 01 (20081208)
5-125
M2000
iSStar User Guide
Enumerated Type
Detailed Information
[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.
END_TIME
NOTE
If neither the start time nor the
end time is set, all the alarm data
is queried.
ALARMINFO_SEQ
5-126
Issue 01 (20081208)
M2000
iSStar User Guide
Enumerated Type
Detailed Information
alarm. The values and
meanings are:
l 1: transmission
l
2: mobile
l
l
3: fixed network
narrowband
4: fixed network wideband
5: intelligent
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
2: NodeB
3: SGSN
4: GGSN
5: CG
6: SoftX
7: MGW
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.
NEFDN_SEQ
Issue 01 (20081208)
5-127
M2000
iSStar User Guide
Enumerated Type
ALARMCAUSE_SEQ
ALARMLEVEL_SEQ
ALARMSTATUS_SEQ
5-128
Detailed Information
Sequence of alarm causes.
You can set the item by using
Fmcond
[ALARMCAUSE_SEQ].
The value is a list containing
unlimited elements
indicating the causes to
generate alarms. Set the
length of the sequence to 0
unless otherwise specified.
The values and meanings are
as follows:
l 1: power system
l
2: environment system
3: signaling system
4: relay system
5: hardware system
6: software system
7: running system
8: communications system
9: QoS
2: major
3: minor
4: warning
Issue 01 (20081208)
M2000
iSStar User Guide
Enumerated Type
Detailed Information
indicating alarm status. Set
the length of the sequence to
0 unless otherwise specified.
For fault alarms, the values
and meanings are as follows:
l 1: unacknowledged and
uncleared
l 2: unacknowledged and
cleared
l 3: acknowledged and
uncleared
l 4: acknowledged and
cleared
For event alarms, the values
and meanings are as follows:
l 5: acknowledged
l
LINKFDN_SEQ
Issue 01 (20081208)
6: unacknowledged
5-129
M2000
iSStar User Guide
Enumerated Type
Detailed Information
Sequence of alarm identity.
You can set this item by using
Fmcond[IDENTIF_SEQ].
The value is a list containing
elements indicating alarm
identities.
For fault alarms, the values
and meanings are as follows:
IDENTIF_SEQ
0: note
1: intermittent fault
2: high frequency
intermittent fault
0: note
3: repetitive event
4: high frequency
repetitive event
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
5-130
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
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Table 5-8 Attributes of alarm data records
Attribute
Description
Category
2: Event Alarms
DevFdn
NE
DevCsn
Id
Issue 01 (20081208)
5-131
M2000
iSStar User Guide
Attribute
Description
Type
Level
Restore
Confirm
Operator
5-132
1: Power system
2: Environment system
3: Signaling system
4: Relay system
5: Hardware system
6: Software system
7: Running system
8: Communications system
9: QoS
1: Critical
2: Major
3: Minor
4: Warning
0: Uncleared
1: Cleared
0: Unacknowledged
1: Acknowledged
Issue 01 (20081208)
M2000
iSStar User Guide
Attribute
Description
Paras
ExtendInfo
LinkObjId
LinkType
ReasonId
ClearOperator
Csn
dtRaise
dt: Time.
Issue 01 (20081208)
year
month
day
hour
minute
second
5-133
M2000
iSStar User Guide
Attribute
Description
dtAck
dt: Time.
dtClear
year
month
day
hour
minute
second
dt: Time.
year
month
day
hour
minute
second
Error Handling
If errors occur, you can obtain the error information by referring to Function: GetLastError and
Function: GetErrorMsg.
Example
#################################################
5-134
Issue 01 (20081208)
M2000
iSStar User Guide
#
# parse one record of the alarm data#
# Inputrecord #
#
#################################################
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
#Connect the database.
OpenDB()
#Create an object of alarm query condition.
fmcond = CreateCond(FM_COND)
#Set the sorting type of the queried alarms.
fmcond[RESULT_SORT] = (3, 2)
#Set the time mode for alarm query. fmcond[TIME_MODE] = 0
#Set the time segment for alarm query.
fmcond[START_TIME] = (2008, 11, 17, 15, 00, 00)
fmcond[END_TIME] = (2008, 11, 17, 16, 00, 00)
#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.
Issue 01 (20081208)
5-135
M2000
iSStar User Guide
#Query the alarms that meet the condition and output the number of alarm records.
returncode = QueryFmRcds(fmcond)
Print('QueryFmRcds() return: ' + str(returncode))
#Get the alarm records queried by the QueryFmRcds function.
FmRecords = NextFmRcds()
while FmRecords
for fm in FmRecords
detail(fm)
end
FmRecords = NextFmRcds()
end
#Close the database connection.
CloseDB()
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
5-136
QueryPmRcds(Pmcond) enables you to query performance data records. You can get the
performance results by calling the function NextPmRcds.
Call the functionOpenDB to connect to the database before calling this function.
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Pmcond
Description
Pmcond is the query condition object. It is the return value of
calling CreateCond(PM_COND)).
Item of pmcond are enumeration values. The items are:
{NE_TYPEID, FUNCTION_SUBSET, TIME_MODE,
TIME_DEFAULT, PERIOD, START_TIME, END_TIME,
COUNTERID_SEQ, OBJINDEX_SEQ, NEFDN_SEQ,
RESULT_SORT}. For details, refer to Table 5-9.
Detailed Information
ID of NE type. You must set
it before querying the
performance data. You can
set it through pmcond
[NE_TYPEID]. It indicates
the NE type of the alarm. The
values and meanings are:
l 0: COMMON
NE_TYPEID
1: M2000
2: LMT
3: NodeB
4: RNC
5: MSCServer
6: MGW
7: SGSN
8: GGSN80
9: HLR
10: CG
17: SGSN_MML
FUNCTION_SUBSET
TIME_MODE
Issue 01 (20081208)
5-137
M2000
iSStar User Guide
Enumerated Type
Detailed Information
set this item by using pmcond
[TIME_MODE]. The values
and meanings are:
l 0: server time mode
l
1: NE time mode
TIME_DEFAULT
1: YESTERDAY
2: THISWEEK
3: LASTWEEK
4: SPEC
5: ALL
1: 15 minutes
2: 30 minutes
3: 60 minutes
4: 1440 minutes
5-138
Issue 01 (20081208)
M2000
iSStar User Guide
Enumerated Type
START_TIME
Detailed Information
Start time. You can set it
through pmcond
[START_TIME]. The values
are tuples indicating the start
time for querying
performance records. It is
represented by (year, month,
day, hour, minute, second,
time zone offset, DST offset).
By default, all alarms
generated after pmcond
[START_TIME] are queried.
NOTE
If neither the start time nor the
end time is set, all performance
data is queried.
In this format,
l Time zone offset is an
integer. The value ranges
from -12 to 13. The default
value is 0.
l DST offset is an integer.
The value ranges from 0 to
2. The default value is 0.
END_TIME
Issue 01 (20081208)
5-139
M2000
iSStar User Guide
Enumerated Type
COUNTERID_SEQ
OBJINDEX_SEQ
Detailed Information
Sequence of counter IDs.
You can set it through
pmcond
[COUNTERID_SEQ]. The
value is a list whose length is
not limited. Elements in the
list are of long integer type,
indicating the counter IDs.
Sequence of objects indexed.
You can set it through
pmcond[OBJINDEX_SEQ].
The value is a list whose
elements are of integer type
indicating the index numbers
of objects.
NOTE
This parameter is outdated and
retained for compatibility with
previous versions.
NEFDN_SEQ
5-140
Issue 01 (20081208)
M2000
iSStar User Guide
Enumerated Type
Detailed Information
Rule of sorting results. You
can set it through pmcond
[RESULT_SORT]. The
value is a list, [resultsort,
resultsort1,...]. Elements in
the list are tuples containing
three elements. That is,
resultsort = (sortType,
counterId, sortDirection).
RESULT_SORT
1: sort by object
2: sort by time
3: sort by counter
0: not sort
1: ascending order
2: descending order
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()
Issue 01 (20081208)
5-141
M2000
iSStar User Guide
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.
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 the function succeeds, the performance data list 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
#Open the database connection.
OpenDB("admin", "11111111")
#Create an object of performance query.
pmcond = CreateCond(PM_COND)
#Set the NE type.
pmcond[NE_TYPEID] = 1
#Set function subsets.
pmcond[FUNCTION_SUBSET] = 67109402
#Set the time mode to server mode.
pmcond[TIME_MODE] = 0
#Set the query time segment to the specified time segment.
pmcond[TIME_DEFAULT] = 4
#Set the query period to 30 minutes.
pmcond[PERIOD] = 2
#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)
#Set the counter ID sequence.
pmcond[COUNTERID_SEQ] = [67190482, 67190483, 67190731, 67190732, 67202907, 67202908]
#Set the object index sequence.
pmcond[OBJINDEX_SEQ] = [60, 61, 62, 63, 64, 65]
#Set the object FDN.
pmcond[NEFDN_SEQ] = ['.3221229568.3221233664.3221291041']
#Set the sorting rule of query results.
pmcond[RESULT_SORT] = (0, 0, 0)
5-142
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Before calling this function, call 5.4.2 Function: OpenDB to connect the database.
Parameter Description
Parameter
Cmcond
Description
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
Return Value
The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0
is returned.
Issue 01 (20081208)
5-143
M2000
iSStar User Guide
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.
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)
Print("CM result: " + str(ee) )
CMlist = NextCmRcds()
while CMlist
CMlist = NextCmRcds()
end
5-144
Issue 01 (20081208)
M2000
iSStar User Guide
Result
----------### Query the configuration ####---------CM result:2360
Synopsis
GetCmCom(Fdn,objSeq)
Note
l
Call 5.4.2 Function: OpenDB to connect to the database before calling this function.
Parameter Description
Parameter
Description
Fdn
objSeq
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.
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:
Issue 01 (20081208)
data: string type. It indicates results of the attributes in the attribute list.
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
5-145
M2000
iSStar User Guide
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)))
#Close the database connection.
CloseDB()
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
ParentMoc
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.
5-146
Issue 01 (20081208)
M2000
iSStar User Guide
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
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)))
#Close the database connection.
CloseDB()
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.
Issue 01 (20081208)
5-147
M2000
iSStar User Guide
Attribute
Description
neTypeName
period
neFDNList
FssIdList
timeMode
1: NE time mode
NOTE
The default time mode is server time mode.
startTime
endTime
timezoneOffset
dstTimeOffset
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)
5-148
Issue 01 (20081208)
M2000
iSStar User Guide
Result
fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100;
Synopsis
GetFunctionSubSetList(neTypeName)
Note
None.
Parameter Description
Parameter
neTypeName
Description
Name of an NE type.
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:
67109377:
67109378:
67109379:
67109380:
67109381:
67109382:
67109383:
67109384:
Issue 01 (20081208)
5-149
M2000
iSStar User Guide
Synopsis
QueryIntegrityResult(IntegrityReportCond)
Note
None.
Parameter Description
Parameter
Description
IntegrityReport
Cond
Refers to the integrity query conditions, which can be set through 5.4.12
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
Result
result length is: 5
5-150
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
GetOneNEInteLst(resultNeIntegrityLst, neFdn)
Note
None.
Parameter Description
Parameter
Description
resultNeIntegri
tyLst
Refers to the integrity result, which may contain the integrity results of
multiple NEs. This parameter value is the return value of 5.4.14 Function:
QueryIntegrityResult.
neFdn
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:
Issue 01 (20081208)
5-151
M2000
iSStar User Guide
Synopsis
GetOneFssInte(integrityNE, fssId)
Note
None.
Parameter Description
Parameter
Description
integrityNE
fssId
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)
5-152
Issue 01 (20081208)
M2000
iSStar User Guide
Result
fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100;
Synopsis
GetOneIntegrity(resultNeIntegrityLst, neFdn, fssId)
Note
None.
Parameter Description
Parameter
Description
resultNeIntegrityLst
neFdn
fssId
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')
Issue 01 (20081208)
5-153
M2000
iSStar User Guide
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-10.
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
Detailed Information
NE_FDN
TIME_MODE
NOTE
The default time mode is server time mode.
5-154
Issue 01 (20081208)
M2000
iSStar User Guide
Name
Detailed Information
FUNCTION_SUBSET
TIME_DEFAULT
TODAY: Today
YESTERDAY: Yesterday
NOTE
l Unless otherwise specified, the default value of
TIME_DEFAULT is ALL.
l The time specified by START_TIME and
PERIOD
P5: 5 minutes
P15: 15 minutes
P30: 30 minutes
P60: 60 minutes
NOTE
The default period is 30 minutes.
START_TIME
END_TIME
Issue 01 (20081208)
5-155
M2000
iSStar User Guide
Name
Detailed Information
COUNTERID_SEQ
OBJINSTANCE_SEQ
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.
5-156
Issue 01 (20081208)
M2000
iSStar User Guide
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-11.
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
Detailed Information
ALARM_CATE
2: Event alarms
NOTE
The default alarm type is current fault alarm.
TIME_MODE
NOTE
The default time mode is server time mode.
START_TIME
END_TIME
Issue 01 (20081208)
5-157
M2000
iSStar User Guide
Name
Detailed Information
ALARMINFO_SEQ
1: Transmission
2: Mobile
5: Intelligent
6: Network management
100000: OMC
1: RNC
2: NodeB
3: SGSN
4: GGSN
5: CG
6: SoftX
7: MGW
8: HLR
5-158
Issue 01 (20081208)
M2000
iSStar User Guide
Name
Detailed Information
ALARMCAUSE_SEQ
ALARMLEVEL_SEQ
Issue 01 (20081208)
1: Power system
2: Environment system
3: Signaling system
4: Relay system
5: Hardware system
6: Software system
7: Operating system
8: Communication system
1: Critical
2: Major
3: Minor
4: Warning
5: Unassured
5-159
M2000
iSStar User Guide
Name
Detailed Information
ALARMSTATUS_SEQ
5-160
5: Acknowledged
6: Unacknowledged
LINKFDN_SEQ
LINKTYPE_SEQ
400: MTP3
401: MTP3B
408: H248
409: BICCSCTP
410: M3UA
499: DATA
Issue 01 (20081208)
M2000
iSStar User Guide
Name
Detailed Information
IDENTIF_SEQ
0: Note
1: Intermittent fault
0: Note
3: Repeat event
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)
Issue 01 (20081208)
5-161
M2000
iSStar User Guide
Note
None.
Parameter Description
Parameter
queryCond
Description
queryCond refers to the conditions for querying performance data or
alarm data. You can set conditions for querying performance data and
alarm data by referring to 5.4.18 Function: GetPmCond and 5.4.19
Function: GetFmCond, respectively.
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)
5-162
Issue 01 (20081208)
M2000
iSStar User Guide
Result of Example 2
71
Synopsis
RecordCount(resultHolder)
Note
None.
Parameter Description
Parameter
resultHolder
Description
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
Issue 01 (20081208)
5-163
M2000
iSStar User Guide
Synopsis
NextRecord(resultHolder)
Note
None.
Parameter Description
Parameter
resultHolder
Description
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
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.
5-164
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-12.
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-13.
Issue 01 (20081208)
M2000
iSStar User Guide
Detailed Information
2: Event alarm
Issue 01 (20081208)
1: Power system
2: Environment system
3: Signaling system
4: Relay system
5: Hardware system
6: Software system
7: Operating system
8: Communications system
5-165
M2000
iSStar User Guide
Detailed Information
10
1: Critical
2: Major
3: Minor
4: Warning
0: Uncleared
1: Cleared
0: Unacknowledged
1: Acknowledged
11
12
13
14
15
16
17
5-166
Issue 01 (20081208)
M2000
iSStar User Guide
Detailed Information
18
19
Detailed Information
...
Issue 01 (20081208)
True: Credible
False: Incredible
5-167
M2000
iSStar User Guide
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
5-168
Issue 01 (20081208)
M2000
iSStar User Guide
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
mocName
neFdn
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']
Issue 01 (20081208)
5-169
M2000
iSStar User Guide
Synopsis
GetMocList(neFdn)
Note
None.
Parameter Description
Parameter
neFdn
Description
neFdn is a string and refers to the NE FDN.
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)
5-170
Issue 01 (20081208)
M2000
iSStar User Guide
Note
None.
Parameter Description
Parameter
Description
funcSubsetId
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.
Issue 01 (20081208)
5-171
M2000
iSStar User Guide
Parameter Description
Parameter
Description
funcSubsetId
period
P5: 5 minutes
P15: 15 minutes
P30: 30 minutes
P60: 60 minutes
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.
5-172
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
neTypeId
Description
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
funcsetId
Issue 01 (20081208)
Description
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.
5-173
M2000
iSStar User Guide
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
moiuni
attrList
Description
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
neFdn: NE FDN
5-174
Issue 01 (20081208)
M2000
iSStar User Guide
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
Result of Example 1
['NULL', 'NULL', 'NULL', 'NULL', 'Cabinet No.=0, Site Index=3', '116', 'NULL']
Example 2
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
mocName
neFdn
Issue 01 (20081208)
5-175
M2000
iSStar User Guide
Parameter
attrFilters
Description
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
R: Greater than
L: Less than
Equal: Equal to
Unequal: Unequal 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
neFdn: NE FDN
Error Handling
If an error occurs, you can obtain the error information by referring to Function: GetLastError
and Function: GetErrorMsg.
5-176
Issue 01 (20081208)
M2000
iSStar User Guide
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
Result of Example 2
[(3221987329L,'.3221287013.3221975040.3221979137.3221987329','.
3221229568.3221233664.3221287013')]
Synopsis
GetPmNeType([typeName])
Note
None.
Parameter Description
Parameter
typeName
Issue 01 (20081208)
Description
typeName is a string and refers to the type name of an NE. This parameter
is optional.
5-177
M2000
iSStar User Guide
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).
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.
5-178
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
neFdn
Description
neFdn is a string and refers to the NE FDN.
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.
Issue 01 (20081208)
5-179
M2000
iSStar User Guide
Example
#Connect the database.
OpenDB("admin", "11111111")
#Close the database connection.
returncode = CloseDB()
Print('CloseDB() return: ' + str(returncode))
Result
CloseDB() return: 1
Description
Issue 01 (20081208)
M2000
iSStar User Guide
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
alarmID
category
1: fault alarm
2: clearance alarm
3: event alarm
alarmInfo
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")
ret = SendAlarm(600, 3, 'alarm detail')
Print("To View the Alarms,please click Monitor->Event Alarms")
Result
Sending an alarm:ID Alarm ID:600,Alarm type:Event alarm,:alarm detail
To View the Alarms,please click Monitor->Event Alarms
5-181
M2000
iSStar User Guide
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.
5-182
Issue 01 (20081208)
M2000
iSStar User Guide
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
opName
targetName
detailInfo
auditResult
Return Value
The return value is null.
Error Handling
None
Issue 01 (20081208)
5-183
M2000
iSStar User Guide
Example
Print("operation log:operation:my op,object:OMC,details:op details,result:success")
LOG_OP("my op", 'OMC', 'op details', 0)
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.
5-184
Issue 01 (20081208)
M2000
iSStar User Guide
Description
Parameter
value
Description
String to be converted.
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.
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.
Issue 01 (20081208)
5-185
M2000
iSStar User Guide
Description
Parameter
value
Description
String to be converted.
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.
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.
5-186
Issue 01 (20081208)
M2000
iSStar User Guide
Description
Parameter
value
Description
String to be converted.
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.
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.
Issue 01 (20081208)
5-187
M2000
iSStar User Guide
Description
Parameter
value
Description
Sequence to be converted, such as strings, tuples, lists, and
dictionaries. For dictionaries, the collection of key values of the
dictionaries is converted to a tuple.
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.
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.
5-188
Issue 01 (20081208)
M2000
iSStar User Guide
Description
Parameter
value
Description
Sequence to be converted, such as strings, tuples, lists, and
dictionaries. For dictionaries, the collection of key values of the
dictionaries is converted to a tuple.
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.
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
value
Issue 01 (20081208)
Description
Data to be converted. The data can be of any type.
5-189
M2000
iSStar User Guide
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.
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')
Issue 01 (20081208)
M2000
iSStar User Guide
Description
Issue 01 (20081208)
5-191
M2000
iSStar User Guide
Function
Description
Time Format
Format
5-192
Description
%a
%A
%b
%B
%c
%d
%H
%I
%j
%m
%M
%p
%S
%U
Week number of the year (Sunday as the first day of the week) as a decimal
number [00, 53]. All days in a new year preceding the first Sunday are
considered to be in week 0.
Issue 01 (20081208)
M2000
iSStar User Guide
Format
Description
%w
%W
Week number of the year (Monday as the first day of the week) as a decimal
number [00, 53]. All days in a new year preceding the first Monday are
considered to be in week 0.
%x
%X
%y
%Y
%Z
%%
Tuple Elements
No.
Element
Value Range
Description
Year
0-9999
Month
1-12
Date
1-31
Hour
0-23
Minute
0-59
Second
0-59
Second as a numerical
value
Week
0-6
Weekday as a numerical
value (0 indicates Monday)
Day
1-366
-1, 0, and 1
Issue 01 (20081208)
DST
5-193
M2000
iSStar User Guide
Synopsis
GMTime([Secs])
Note
None.
Parameter Description
Parameter Name
Description
Secs is a floating number with the unit represented in second. The
time starts from 1970/01/01 00:00:00.
Secs
The default of secs is the return value of invoking the Time function.
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)
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
LocalTime([Secs])
Note
None.
Parameter Description
Parameter Name
Description
Secs is a floating number with the unit expressed in second. The time
starts from 1970/01/01 00:00:00.
Secs
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]
Print("%d/%d/%d"%(day,month,year))
#Get the local time and the values of year, month, and date
Result
13/10/2006
Synopsis
MkTime([t])
Note
None.
Issue 01 (20081208)
5-195
M2000
iSStar User Guide
Parameter Description
Parameter
Name
Description
The value elements of t is consists of year, month, day, hour, minute,
second, week, date number, and DST. It can be the return value of
LocalTime() or GMTime(). For details about the value format, see5.8.3
Time Tuple.
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()))
Print(MkTime(LocalTime()))
#According to the GMT time, obtain the difference (in second) between
#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
Secs
Description
The Secs parameter is of the numeric type. It indicates the paused
time. The unit is expressed in second.
Secs can be a decimal.
5-196
Issue 01 (20081208)
M2000
iSStar User Guide
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
Name
Description
format
It is used to define the time format. For details, see the Time Format
function.
Return Value
The formatted time string is returned.
Issue 01 (20081208)
5-197
M2000
iSStar User Guide
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
string
format
It is used to define the time format. For details, see the 5.8.2 Time
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)
5-198
Issue 01 (20081208)
M2000
iSStar User Guide
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()
#Output the GMT time.
Print("GMT in seconds : " + str(secs) + " S")
Print("The tuple representation of the GMT time: " + str(GMTime(secs)) )
Print("---------------------------------")
#Output the hour, minute, and second of the GMT time.
Print(StrfTime("%H:%M:%S", GMTime(secs) ))
#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()
Issue 01 (20081208)
5-199
M2000
iSStar User Guide
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
t is a tuple, which can be the return value of GMTime or LocalTime. For
details of the structure, see the Time Tuple function. The default value is
the return value of the LocalTime function.
NOTE
If t is not provided, the current time returned by the LocalTime function is used.
Return Value
The return value is a string in the format of Week Month Day Hour: Minute: Second Year.
5-200
Issue 01 (20081208)
M2000
iSStar User Guide
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
5-201
M2000
iSStar User Guide
Description
Synopsis
UserInput(EventPropmt[, EventType[, Items]]), InputText(EventPropmt[, EventType[, Items]])
Note
The function UserInput() is equivalent to InputText().
5-202
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
EventPropmt
EventType
Items
(elements in the list or tuple must be strings), the input information must
be the elements of Items.
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)
Print('UserInput() return: ' + Msg)
Msg = UserInput('input: ', 2)
Print('UserInput() return: ' + Msg)
Msg = UserInput('input item from ABCD:',1,'ABCD')
Print('UserInput() return: ' + Msg)
Result
UserInput() return: Hello
UserInput() return: World
UserInput() return: A
Synopsis
UserOutput(EventPropmt[, EventType]),OutputText(EventPropmt[, EventType])
Issue 01 (20081208)
5-203
M2000
iSStar User Guide
Note
The function UserOutput() is equivalent to OutputText().
Parameter Description
Parameter
Name
Description
EventPropmt
EventType
Return Value
None.
Error Handling
None.
Example
UserOutput("This is a test text of UserOutput function.")
Result
This is a test text of UserOutput function.
Synopsis
SetOutMode(Mode)
Note
None.
5-204
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Mode
Description
Mode is a string. It indicates the output mode. The value of the
output modes is as follows:
l
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')
Print("Hello!")
SetOutMode("file")
SetOutFileName("E:\\sample.txt")
Print("Hello world!")
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.
Issue 01 (20081208)
5-205
M2000
iSStar User Guide
Parameter Description
Parameter
Flag
Description
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
0.0
[]
()
{}
None
""
''
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)
Print("Hello world!")
SetOutFlag(True)
Print("Hello!")
Result
Hello!
Synopsis
SetOutFileName(FileName)
5-206
Issue 01 (20081208)
M2000
iSStar User Guide
Note
l
If the output file is not set, the output mode contains the file mode. The default output file
is used.
Parameter Description
Parameter
FileName
Description
FileName is a string. It indicates the output file name. Windows-style
file path (containing \\) and Unix-style file path (containing /) are both
supported.
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
SetOutMode("file")
# Set the output mode
SetOutFileName("D:\\sample.txt") # Set the name of the
Print("Hello!")
# Print the string on the
the GUI
to file
output file
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.
Issue 01 (20081208)
5-207
M2000
iSStar User Guide
Parameter Description
Parameter
Msg
Description
Msg is a string. It indicates the information needed to be printed. For
details of the string, see String.
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!")
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.
5-208
Issue 01 (20081208)
M2000
iSStar User Guide
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
Progress
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.")
Issue 01 (20081208)
5-209
M2000
iSStar User Guide
Description
Issue 01 (20081208)
M2000
iSStar User Guide
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
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.
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
errID
Issue 01 (20081208)
Description
The value of errID is a positive integer or zero. It indicates the error
code.
5-211
M2000
iSStar User Guide
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.
For details of error information, see Table 5-19.
Table 5-19 Description of error information
Name
Meaning
ErrorCode
ErrorLevel
ModuleID
ErrorDescription
Meaning
ERROR_LEV_OK
ERROR_LEV_NOTICE
ERROR_LEV_WARNING
ERROR_LEV_ERROR
Error Handling
None.
Related Examples
Example
Print("No Error Occurred")
errorlist = GetLastError()
5-212
Issue 01 (20081208)
M2000
iSStar User Guide
Print("")
Print("One Error Occurred")
knownIp = "0.0.0.0"
# an error occurred in login ftp
result = LoginFTP( knownIp, "UserName", "Password")
# Log in to the FTP server
errorlist = GetLastError()
# Get the error code
Print("errorlist: " + str(errorlist))
Print("error message: " + GetErrorMsg(errorlist[0]))
# Get the error information
Result
No Error Occurred
errorlist: (0, '', ('<string>',0,'?'))
error message: ErrorCode:0x0
ErrorLevel:0
ModuleID:0
ErrorDescription:Request has been successfully executed.
One Error Occurred
errorlist: (1879117828, '', ('...FTPOp.py', 126, 'LoginFTP'))
error message: ErrorCode:0x70011004
ErrorLevel:3
ModuleID:1
ErrorDescription:Python exception.
5-213
M2000
iSStar User Guide
Description
5-214
Function
Description
Issue 01 (20081208)
M2000
iSStar User Guide
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.
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.
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.
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
mode
Description
mode is of Boolean. The default value is True.
When the mode parameter is True, set the FTP mode to passive. When
the mode parameter is False, set the FTP mode to active.
Issue 01 (20081208)
5-215
M2000
iSStar User Guide
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.
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
Host
UserName
Password
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
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
Upload(SrcFile, TargetFile)
Note
l
You need to call the LoginFTP function to connect to the server before calling this function.
The source file path and target file path must exist. Otherwise uploading fails.
If a file with the name of the uploaded one exists in the target file path, overwrite the file.
Parameter Description
Parameter
Name
SrcFile
Description
SrcFile is a string. It indicates the name of the file to be uploaded. It
supports Windows-style file path (containing \\) and Unix-style file path
(containing /).
NOTE
l If the file to be uploaded exists, SrcFile must be set to an absolute path.
l If the file to be uploaded is generated during the execution of the task,
SrcFile can be set to a relative path, and the relative path is the task output path.
TargetFile is a string. It indicates the target file which the uploaded file
is saved. It supports Windows-style file path (containing \\) and Unixstyle file path (containing /).
TargetFile
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)
Issue 01 (20081208)
5-217
M2000
iSStar User Guide
Note
l
You need to call the LoginFTP function to connect to the server before calling this function.
The source file path and target file path must exist. Otherwise downloading fails.
If a file with the name of the downloaded one exists in the target file path, overwrite the
file.
Parameter Description
Parameter Name
Description
SrcFile
TargetFile
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.
5-218
Issue 01 (20081208)
M2000
iSStar User Guide
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.
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.
Issue 01 (20081208)
5-219
M2000
iSStar User Guide
Parameter Description
Parameter
Name
Parameter Description
strHostIp
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
Name
5-220
Description
telnet
telnet is of the object type, which identifies a telnet object. It is the return
value of 5.11.8 OpenTelnet Function.
strCmd
timeout
Timeout
is of the integer type. It indicates the timeout value of a command. By
default, the timeout value is 60 seconds.
Issue 01 (20081208)
M2000
iSStar User Guide
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
Name
telnet
Description
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)
5-221
M2000
iSStar User Guide
Synopsis
CloseTelnet (telnet)
Important
None.
Parameter Description
Parameter
Name
telnet
Parameter Description
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"
# Upload file to ftp server
def uploadFileToServer()
if GetFTPStatus() and Upload(localFilePath,serverFilePath)
Print("upload finished!")
else
Print("upload failed!")
Print(GetLastError())
end
end
# Download file from server
def downloadFileFromServer()
if GetFTPStatus() and Download(serverFilePath, distFilePath)
Print("download finished!")
else
5-222
Issue 01 (20081208)
M2000
iSStar User Guide
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!
Issue 01 (20081208)
5-223
M2000
iSStar User Guide
+++
HW-BSC6800
2008-10-25 16:41:49
O&M
#873
%%LGI:op="lmtlmtlmt",pwd="*****";%%
RETCODE = 234915312 "lmtlmtlmt" is an invalid operator name, login failed.
---
END
+++
HW-BSC6800
O&M
#874
%%
LST OP:;%%
RETCODE = 234915884
command.
---
2008-10-25 16:41:59
END
Issue 01 (20081208)
M2000
iSStar User Guide
This gives the examples of the report operation function. You can better understand how to use
report operation functions to perform routine maintenance.
Description
Function: NewReport
Creates a report.
Function: AddSheet
Adds a sheet.
Function: AddTable
Adds a table.
Function: AddRange
Creates a range.
Function: SetRangeValue
Function: SetCellValue
Function: SetTableValue
Function: SetTableValueEx
Function: GetRowCount
Function: GetRowData
Function: InsertRow
Function: RemoveRow
Function: UpdateRow
Function: Selector
Function: ReportStyle
Function: SetTableFont
Function: SetTableTitleFont
Function: SetRangeFont
Function: SetCellFont
Issue 01 (20081208)
5-225
M2000
iSStar User Guide
Function
Description
Function: SetTableBGColor
Function: SetRangeBGColor
Function: SetCellBGColor
Function: SetRangeAlign
Function: SetCellAlign
Function: SetColumnWidth
Function: LoadReport
Function: SaveReportAs
Function: StoreReport
5.12.6 Examples of Report Operation Function shows the examples. The procedure of report
operations is as follows:
1.
2.
Create a sheet.
3.
Create a table.
4.
5.
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
5-226
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.
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.
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
TableHandle
RowFrom
ColFrom
RowTo
ColTo
bMerged
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 sheet named page one.
page1 = AddSheet("page one")
#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)
#Save the report as an .xls file.
SaveReportAs("d:/exa04.xls")
Related Example
Issue 01 (20081208)
5-227
M2000
iSStar User Guide
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.
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.
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.
Parameter Description
Parameter
SheetName
Description
SheetName is a character string. It indicates the sheet name. The sheet
name must be unique.
Return Value
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.
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.
page1 = AddSheet("page one")
#Add a second sheet named page two.
page2 = AddSheet("page two")
#Save the report as an .xls file.
SaveReportAs("d:/exa02.xls")
Related Example
5-228
Issue 01 (20081208)
M2000
iSStar User Guide
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
If you add multiple tables to the same page, tables are separated by three blank rows.
The maximum row number is 65530, and the maximum of total column number is 255.
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
Row
Col
TableName
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 sheet named page one.
Issue 01 (20081208)
5-229
M2000
iSStar User Guide
= AddSheet("page one")
#Add a table with six rows and eight columns. The title is table.
table1 = AddTable(page1, 6, 8, "table1")
#Save the report as an .xls file.
SaveReportAs("d:/exa03.xls")
Related Example
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
SheetName
TableNo
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")
5-230
Issue 01 (20081208)
M2000
iSStar User Guide
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
SheetName
TableNo
RowNo
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")
Issue 01 (20081208)
5-231
M2000
iSStar User Guide
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
SheetName
TableNo
RowNo
DataList
Return Value
The return value is an integer. If this function is successfully called, 1 is returned. Otherwise, 0
is returned.
5-232
Issue 01 (20081208)
M2000
iSStar User Guide
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")
#Insert a row of data to the specified row in the specified table.
InsertRow( sheetName, tableNo, rowNo, datalist )
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
SheetName
TableNo
RowNo
Return Value
The return value is an integer. If row number is modified successfully called, 1 is returned.
Otherwise, 0 is returned.
Issue 01 (20081208)
5-233
M2000
iSStar User Guide
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)
#Delete the second row from table 0 in sheet1.
ret = RemoveRow("sheet1", 0, 2)
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
Exp
Description
Exp is a string. It indicates a conditional expression.
The keywords of the condition express are as follows:
l
5-234
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter
Mode
Description
Mode is of enumeration type. It indicates the mode used to define
the display style of the data aggregate that meets the conditional
expression. The value can be CELL_MODE, ROW_MODE, and
COL_MODE. The meaning of each value is as follows:
l
Meaning
Issue 01 (20081208)
5-235
M2000
iSStar User Guide
Conditional Expression
Meaning
$$ == 'Error'
NOTE
The configuration mode of this type of expression
can only be CELL_MODE. Other configuration
modes are not applicable.
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
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: SetCellValue
This describes the SetCellValue function. This function enables you to set the values of the
specified cell.
Synopsis
SetCellValue(TableHandle, Row, Col, Value)
5-236
Issue 01 (20081208)
M2000
iSStar User Guide
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
Row
Col
Value
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")
#Set the value of the cell in row 3 and column 3 in table1.
resultCode = SetCellValue(table1, 3, 5, "SetCellValue")
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)
Issue 01 (20081208)
5-237
M2000
iSStar User Guide
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.
If the cells are set to merge when you create the range, this function sets the display contents
of the merged range.
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
RangeHandle
Value
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)
#Set the range values.
resultCode = SetRangeValue(range1, "SetRangeValue")
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])
5-238
Issue 01 (20081208)
M2000
iSStar User Guide
Note
l
Before calling the SetTableValueEx function, you need to call the NewReport function.
When the function is called, the rows or columns that are beyond the settings of TbData
are truncated.
Parameter Description
Parameter
Description
TableHandle
TbData
Exps
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 style.
style1 = ReportStyle(Red)
#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')
Issue 01 (20081208)
5-239
M2000
iSStar User Guide
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).
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.
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
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.
5-240
Issue 01 (20081208)
M2000
iSStar User Guide
Example
NewReport()
page1 = AddSheet("Page1")
table1 = AddTable(page1, 6, 8, "Table1")
valueList = [str(i) for i in range(6 * 8)]
#Set the values of all the cells in table1.
resultCode = SetTableValue(table1, valueList)
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
SheetName
TableNo
RowNo
DataList
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()
Issue 01 (20081208)
5-241
M2000
iSStar User Guide
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.
Before calling the ReportStyle function, you need to call the NewReport function.
Parameter Description
Parameter
BgColor
Description
BgColor is an integer. It indicates the background color. The values
range from 0 to 39.
The default value is White.
To know the meaning of Bgcolor, refer to Parameter: Color.
Align
L or I
C or c
R or r
5-242
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter
Font
Description
Font is of tuple type. It contains four elements, that is, type, size,
color, and bold.
l
Size is an integer. It indicates the font size. The value ranges from
7 to 36 pounds.
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.
Issue 01 (20081208)
5-243
M2000
iSStar User Guide
Parameter Description
Parameter
Parameter Description
TableHandle
Row
Col
Type
Type is a character. It indicates the content align type within the range.
The optional values are as follows:
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)
#Set the cell in row 3 and column 5 in table1 to be centered.
SetCellAlign(table1, 3, 5, "C")
SaveReportAs("example.xls")
Result
A file example.xls is created
5-244
Issue 01 (20081208)
M2000
iSStar User Guide
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
Row
Col
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
Issue 01 (20081208)
5-245
M2000
iSStar User Guide
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
Row
Row is an integer. It indicates the row position. Row number begins from
0.
Col
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
bBold
The value 0 means that the fonts are displayed in normal conditions.
Return Value
The return value is an integer. If the font the cell is set successfully, 1 is returned. Otherwise, 0
is returned.
5-246
Issue 01 (20081208)
M2000
iSStar User Guide
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.
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
Col
Width
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.
Issue 01 (20081208)
5-247
M2000
iSStar User Guide
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.
Before this function is called, you should call Function: AddRange to create an area.
Parameter Description
Parameter
Description
RangeHandle
Type
5-248
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Before this function is called, you should call Function: AddRange to create an area.
Parameter Description
Parameter
Description
RangeHandle
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.
Issue 01 (20081208)
5-249
M2000
iSStar User Guide
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.
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
RangeHandle
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
5-250
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter
bBold
Parameter Description
bBold is of Boolean type. It indicates whether fonts are in bold.
l
The value 0 means that the fonts are displayed in normal conditions.
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.
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.
Issue 01 (20081208)
5-251
M2000
iSStar User Guide
Parameter Description
Parameter
Description
TableHandle
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.
5-252
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
TableHandle
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
bBold
The value 0 means that the fonts are displayed in normal conditions.
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)
#Set the font of table1 to Century, 9 pounds, red, and bold.
resultCode = SetTableFont(table1, 5, 9, Red, 1)
SaveReportAs("example.xls")
Related Example
Issue 01 (20081208)
5-253
M2000
iSStar User Guide
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
TableHandle
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
bBold
The value 0 means that the fonts are displayed in normal conditions.
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.
5-254
Issue 01 (20081208)
M2000
iSStar User Guide
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
FilePath
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)
Issue 01 (20081208)
5-255
M2000
iSStar User Guide
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.
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)
5-256
Issue 01 (20081208)
M2000
iSStar User Guide
Note
l
The save path does not support the network path format.
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.
Parameter Description
Parameter
FilePath
Description
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.
Issue 01 (20081208)
5-257
M2000
iSStar User Guide
Synopsis
StoreReport(filePath)
Note
None
Parameter Description
Parameter
Description
filePath
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
5-258
Issue 01 (20081208)
M2000
iSStar User Guide
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-25 describes
the meaning of each color.
Figure 5-9 Optional colors
Meaning
Black
Brown
Olive_Green
Dark_Green
Dark_Teal
Dark_Blue
Indigo
Gray80
Dark_Red
Orange
Issue 01 (20081208)
5-259
M2000
iSStar User Guide
5-260
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
Issue 01 (20081208)
M2000
iSStar User Guide
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-26 lists the meaning of each value.
NOTE
If the fonts are not defined, the default settings are as follows:
l
Font: Arial
Size: 9 pounds
Color: Black
Bold: No
Meaning
Arial
Courier New
Sample
2
3
4
5
Century
MS Gothic
7
8
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-27.
Issue 01 (20081208)
5-261
M2000
iSStar User Guide
Meaning
L',l'
C',c'
R',r'
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
AddSheet(sheetname)
AddTable(SheetHandle, row, col, tablename)
SetCellValue(TableHandle, row, col, pszValue)
SetRangeValue(RangeHandle, pszValue)
SetTableValue(TableHandle, list)
color_sample.hsl
#create new sheet namedcolor
page1 = AddSheet("color")
table1 = AddTable(page1, 6, 8, "color sample")
table2 = AddTable(page1, 25, 8, "Edit table color")
5-262
Issue 01 (20081208)
M2000
iSStar User Guide
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)
Issue 01 (20081208)
5-263
M2000
iSStar User Guide
font,
font,
font,
font,
7)
15)
defaultSize, red)
defaultSize, defaultColor, bold)
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")
Issue 01 (20081208)
M2000
iSStar User Guide
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: MkDir
This function enables you to create a directory. You must ensure that the parent directory exists.
5.13.7 Function: RmDir
This function enables you to delete the specified directory.
5.13.8 Function: GetCwd
This function is used to display the current working path.
5.13.9 Function: Remove
This function enables you to delete the specified file.
5.13.10 Function: Rename
This function enables you to change the name of a file or directory.
5.13.11 Function: ListDir
This function lists all the files in the specified folder.
5.13.12 Function: MakeDirs
This function enables you to create directories recursively, such as, creating all the intermediatelevel directories (including the lead directory).
5.13.13 Function: RemoveDirs
This function enables you to recursively remove the specified directories.
5.13.14 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-28.
Table 5-28 List of directory operation functions
Function
Description
Issue 01 (20081208)
5-265
M2000
iSStar User Guide
Function
Description
Synopsis
Open(filename[,mode])
Note
5-266
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.
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.
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Name
filename
Description
The file to be opened.
The modes for opening the file are as follows:
mode
'r' indicates the read mode. The opened file is used for reading.
'w' indicates the write mode. In this mode, the file can be cleared.
'w+' indicates the read and write mode. In this mode, the file can be
cleared.
'a+' indicates the read and write mode. The data is written in an append
mode.
NOTE
l If 't' is appended to the mode, you can specify that the file is opened in text mode.
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
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
Issue 01 (20081208)
When using the Read function, you need to open the existing file in a read mode through
the Open function.
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
5-267
M2000
iSStar User Guide
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
Name
Description
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
0.
size
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')
str = fp.read()
Print(str)
Results
12345
Synopsis
File_object.write(str)
Note
5-268
When using the Write function, you need to open the existing file in a read mode through
the Open function.
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.
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Name
Description
str
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.
Issue 01 (20081208)
5-269
M2000
iSStar User Guide
Example
fp = Open("d:\\Hello.txt")
fp.close()
Synopsis
MkDir(Path)
Note
None.
Parameter Description
Parameter
Description
Path is a string. It indicates the directory path to be created. It supports
Windows-style file path (containing \\) and Unix-style file path
(containing /).
Path
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.
5-270
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
Path is a string. It indicates the directory path to be deleted. It
supports Windows-style file path (containing \\) and Unix-style file
path (containing /).
Path
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)
Issue 01 (20081208)
5-271
M2000
iSStar User Guide
Note
l
The file name represented by the filename parameter must exist and allows to be deleted.
If the file to be deleted is being used, then the file fails to be deleted.
Parameter Description
Parameter
Description
filename is a string. It indicates the file to be removed, which may
contain the path (the default path is the current path).
filename
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.
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.
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
Src
5-272
Description
Src is a string. It indicates the path of the original file, which may contain
the path with the default as the current path. It supports Windows-style
file path (containing \\) and Unix-style file path (containing /).
Huawei Proprietary and Confidential
Copyright Huawei Technologies Co., Ltd.
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter
Description
Dst is a string. It indicates the path of the renamed file, which may contain
the path with the default as the current path. It supports Windows-style
file path (containing \\) and Unix-style file path (containing /).
Dst
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
Files are arranged in the alphabetic order and do not display the symbols "." and ".." in the
file directory.
Parameter Description
Parameter
Path
Description
Path is a string. It indicates the directory of the specified folder. It supports
Windows style file path (containing \\) and Unix style file path (containing /).
If the Path is null, then the function lists all the files in the folder on the
current working path.
Return Value
The return value is a list containing the names of all files in the directory.
Error Handling
None.
Related Examples
Issue 01 (20081208)
5-273
M2000
iSStar User Guide
Synopsis
MakeDirs(Path)
Note
This function can be used to create all the intermediate-level directories, including the leaf
directory.
Parameter Description
Parameter
Description
Path is a string. It indicates the directory to be created. It supports
Windows style file path (containing \\) and Unix style file path
(containing /).
Path
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.
5-274
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter Description
Parameter
Description
Path is a string. It indicates the directory to be removed. It supports
Windows style file path (containing \\) and Unix style file path
(containing /).
Path
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.
Current path is:
d:
The file contained in d:\Path is:
['Dst.txt', 'Path1', 'Path2', 'Path3']
Issue 01 (20081208)
5-275
M2000
iSStar User Guide
5-276
Issue 01 (20081208)
M2000
iSStar User Guide
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.
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.
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.
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-29.
Table 5-29 List of GUI interactive library functions
Function
Description
Issue 01 (20081208)
5-277
M2000
iSStar User Guide
5.14.13 Examples of GUI Interactive Library Function shows examples of creating a GUI
interactive interface. The procedure is as follows:
1.
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.
Description
Create a label
5.14.6 Function:
CheckBox
5.14.7 Function:
RadioBoxGroup
Control Preview
Issue 01 (20081208)
M2000
iSStar User Guide
Description
Issue 01 (20081208)
5-279
M2000
iSStar User Guide
Concept
Description
5-280
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
CreateForm (title, buttonList)
Precaution
None.
Parameter Description
Parameter
Description
title
buttonList
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.
Issue 01 (20081208)
5-281
M2000
iSStar User Guide
Parameter Description
Parameter
Description
formId
width
text
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
5-282
Parameter
Description
formId
width
text
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter
Description
bPwd
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"])
Label(form1,180, " Please enter your name:")
hEdit1 = Edit(form1, 100)
Enter(form1)
Label(form1,180, " Please enter your password:")
hEdit2 = Edit(form1,100,"",True)
Enter(form1)
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
formId
width
Issue 01 (20081208)
5-283
M2000
iSStar User Guide
Parameter
Description
caption
selected
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
5-284
Parameter
Description
formId
width
Issue 01 (20081208)
M2000
iSStar User Guide
Parameter
Description
choices
caption
dimension
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
formId
Issue 01 (20081208)
5-285
M2000
iSStar User Guide
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
formId
width
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.
5-286
Issue 01 (20081208)
M2000
iSStar User Guide
Example
form1 = CreateForm(" Welcome !",["Confirm"])
Label(form1,150, "Line1: begin")
Label(form1,50, "end")
Enter(form1)
Label(form1,150, "Line2: begin")
Space(form1,100)
Label(form1,50, "end")
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.
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
formId
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.
Error Handling
None.
Issue 01 (20081208)
5-287
M2000
iSStar User Guide
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.
The return value is None if you call this function to obtain the input information before the
controls are displayed.
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
componentId
Return Value
The return value is related to the type of the control. For details, see Table 5-32.
Table 5-32 Return values
5-288
Control Type
Return Value
Example
Edit
input
CheckBox
True or False
Issue 01 (20081208)
M2000
iSStar User Guide
Control Type
Return Value
Example
RadioBoxGroup
None
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
formId
Return Value
None.
Error Handling
None.
Issue 01 (20081208)
5-289
M2000
iSStar User Guide
Example
form1 = CreateForm(" Welcome !",["Confirm"])
ShowForm(form1)
DeleteForm(form1)
Example
#Create the first form.
form1 = CreateForm(" Welcome !",["Confirm", "Cancel"])
Label(form1,180, " Please enter your name:")
hEdit1 = Edit(form1, 100)
Enter(form1)
Label(form1,180, " Please enter your password:")
hEdit2 = Edit(form1,100,"",True)
Enter(form1)
chkbox = CheckBox(form1, 500, "Don't show this next time.")
#Display a dialog box and return the characters on the button clicked.
userSelect = ShowForm(form1)
#Get the user input.
strName = GetValue(hEdit1)
strPswd = GetValue(hEdit2)
Print("UserName is:%s"%strName)
Print("Password is:%s"%strPswd)
Print("CheckBox selected is: %s"%str(GetValue(chkbox)))
#Delete the form.
DeleteForm(form1)
#Create a second form.
if userSelect == "Confirm"
form2 = CreateForm("Please select the right answer",["OK"])
Label(form2, 500, "1+1 =? ")
hEnter = Enter(form2)
ls=["0","1","2","3"]
hRadio1 = RadioBoxGroup(form2, 150, ls, "", 2)
ShowForm(form2)
# 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
5-290
Issue 01 (20081208)
M2000
iSStar User Guide
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.
Description
5-291
M2000
iSStar User Guide
Synopsis
CreateTask(filename[,kwargs])
Note
None.
Parameter Description
Parameter
Description
filename is a string. It indicates the name of the script file run by
the task.
filename
NOTE
filename can be set to a relative path, and the relative path is the path of
the current script file.
l
The values of both key and value in the kwargs function must
be a string.
kwargs
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.
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
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
Wait(taskID)
Note
None.
Parameter Description
Parameter
Description
taskID is a string. It indicates the task ID, that is, the taskid of the
return tuple after the CreateTask function is called successfully.
taskID
Return Value
None.
Error Handling
None.
Synopsis
GetRegisterKey(key)
Note
None
Parameter Description
Parameter Name
key
Description
key is a string. It indicates the name of the parameter to be
obtained.
Return Value
In case of success, return the value of key. Otherwise, return None.
Issue 01 (20081208)
5-293
M2000
iSStar User Guide
Error Handling
None
Example
ret = GetRegisterKey('aa')
Print(ret)
Result
None
Synopsis
Exit(errID)
Note
None
Parameter Description
Parameter Name
Description
The value oferrID is a positive integer or zero. It indicates the
error code. It can be the return value of the Call function.
errID
Return Value
None
Error Handling
None
Example
Create the test.hsl script whose content is:
Print("hello")
Exit(0x10)
Print("----------------")
Issue 01 (20081208)
M2000
iSStar User Guide
Result
hello
.................
16
Description
5-295
M2000
iSStar User Guide
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
cond
prompt
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.
5-296
Issue 01 (20081208)
M2000
iSStar User Guide
Synopsis
Assert_OFF()
Note
None.
Parameter Description
None.
Return Value
None.
Error Handling
None.
Synopsis
CreateLoginInfo(SERVER_ADDR,SERVER_PORT)
Note
None.
Issue 01 (20081208)
5-297
M2000
iSStar User Guide
Description
Parameter
Description
SERVER_ADDR
SERVER_PORT
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.
NICK_NAME: NICK_NAME is a dictionary key value. It indicates the nick name of the
user. The value is a string of characters.
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']=''
# Create the first mail contents.
mailInfo1=CreateMailInfo()
# Call the key value of the data dictionary to obtain the corresponding value that is used as the
# The following items cannot be empty at the same time.
mailInfo1['TO_ADDR']='tester@test.com'
mailInfo1['CC_ADDR']=('tester2@test.com','tester3@test.com')
mailInfo1['BCC_ADDR']=['tester4@test.com','tester5@test.comm']
# Set the following information as required.
mailInfo1['FROM_ADDR']='tester1@test.com'
mailInfo1['MAIL_SUBJECT']='test1'
mailInfo1['MAIL_BODY']='this is a test1'
mailInfo1['MAIL_ATTACH']='c:/text.rar' # The attachment text.rar must exist.
# Create the second mail contents.
mailInfo2=CreateMailInfo()
mailInfo2['TO_ADDR']='tester2@test.com'
5-298
Issue 01 (20081208)
M2000
iSStar User Guide
# 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)
# Get the error message for the first mail.
errorInf1=result1[0]
# Error Code
errorCode=errorInf1[0]
# Error Description
errorMsg=errorInf1[1]
# Get the error message for the second mail.
errorInf2=result2[1]
errorCode=errorInf2[0]
errorMsg=errorInf2[1]
Result
# The result of Print(result1)
(0, 'success')
# The result of Print(result2)
[(0, 'success'), (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
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.
Issue 01 (20081208)
5-299
M2000
iSStar User Guide
A single address can be represented by a single string of characters. If there are multiple addresses,
place them in a pair of parentheses or square brackets, and separate the addresses with commas (",").
CC_ADDR: Indicates the address list of the copy-to mails. The value is the same as that
of TO_ADDR.
BCC_ADDR: Indicates the address list of the blind-copy mails. The value is the same as
that of TO_ADDR.
MAIL_BODY: MAIL_BODY is a dictionary key value. It indicates the text of the mail.
The value is a string of characters.
If there is only one attachment, a single string of characters is set as the path of the attachment. If there
are multiple attachments, place them in a pair of parentheses or square brackets, and separate the addresses
with commas (",").
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']=''
# Create the first mail contents.
mailInfo1=CreateMailInfo()
# Call the key value of the data dictionary to obtain the corresponding value that is used as the
# The following items cannot be empty at the same time.
mailInfo1['TO_ADDR']='tester@test.com'
mailInfo1['CC_ADDR']=('tester2@test.com','tester3@test.com')
mailInfo1['BCC_ADDR']=['tester4@test.com','tester5@test.comm']
# Set the following information as required.
mailInfo1['FROM_ADDR']='tester1@test.com'
mailInfo1['MAIL_SUBJECT']='test1'
mailInfo1['MAIL_BODY']='this is a test1'
mailInfo1['MAIL_ATTACH']='c:/text.rar' # The attachment text.rar must exist.
# Create the second mail contents.
mailInfo2=CreateMailInfo()
mailInfo2['TO_ADDR']='tester2@test.com'
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)
5-300
Issue 01 (20081208)
M2000
iSStar User Guide
Result
# The result of Print(result1)
(0, 'success')
# The result of Print(result2)
[(0, 'success'), (0, 'success')]
Synopsis
SendMail(mailInfos)
Note
None.
Description
Parameter
Description
mailInfos
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
2: Login error
Issue 01 (20081208)
5-301
M2000
iSStar User Guide
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']=''
# Create the first mail contents.
mailInfo1=CreateMailInfo()
# Call the key value of the data dictionary to obtain the corresponding value that is used as the
# The following items cannot be empty at the same time.
mailInfo1['TO_ADDR']='tester@test.com'
mailInfo1['CC_ADDR']=('tester2@test.com','tester3@test.com')
mailInfo1['BCC_ADDR']=['tester4@test.com','tester5@test.comm']
# Set the following information as required.
mailInfo1['FROM_ADDR']='tester1@test.com'
mailInfo1['MAIL_SUBJECT']='test1'
mailInfo1['MAIL_BODY']='this is a test1'
mailInfo1['MAIL_ATTACH']='c:/text.rar' # The attachment text.rar must exist.
# Create the second mail contents.
mailInfo2=CreateMailInfo()
mailInfo2['TO_ADDR']='tester2@test.com'
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)
# Get the error message for the first mail.
errorInf1=result1[0]
# Error Code
errorCode=errorInf1[0]
# Error Description
errorMsg=errorInf1[1]
# Get the error message for the second mail.
errorInf2=result2[1]
errorCode=errorInf2[0]
errorMsg=errorInf2[1]
Result
# The result of Print(result1)
(0, 'success')
# The result of Print(result2)
[(0, 'success'), (0, 'success')]
5-302
Issue 01 (20081208)
M2000
iSStar User Guide
Index
Index
A
AscTime function, 5-200
Assert function, 5-295
Assert_OFF function, 5-297
Assert_ON function, 5-296
Assertion function, 5-295
B
block comment, 4-6
built-in function, 4-28
C
CheckBox function, 5-283
close function, 5-269
comment, 4-6
compound statement, 4-3
condition, 4-7
CreateForm function, 5-280
CreateLoginInfo Function, 5-297
CreateMailInfo Function, 5-299
CreateTask function, 5-291
CTime function, 5-199
D
data operation function, 4-29
data type, 4-10
DeleteFrom function, 5-289
dictionary, 4-22
directory operation function, 5-264
Download function, 5-217
E
Edit function, 5-282
Enter function, 5-285
Exit function, 5-294
G
GetCwd function, 5-271
GetError function, 5-210
GetErrorMsg function, 5-211
GetFTPStatus function, 5-218
GetLastError function, 5-210
GetOutputPath function, 5-208
GetRegisterKey function, 5-293
GetValue function, 5-288
GMTime function, 5-194
GUI interactive library function, 5-276
H
HSL reference, 4-1
HSL Syntax, 4-2
I
identifier of HSL, 4-2
input function, 5-201
InputText function, 5-202
K
keyword of HSL, 4-3
L
Label function, 5-281
line comment, 4-6
list, 4-21
list of built-in function, 4-29
ListDir function, 5-273
LocalTime function, 5-194
LoginFTP function, 5-216
LogoutFTP function, 5-219
loop, 4-7
file, 4-24
for loop, 4-7
Issue 01 (20081208)
i-1
M2000
iSStar User Guide
Index
M
Mail Sending Function, 5-297
MakeDirs function, 5-274
method, 4-10
file, 4-24
list, 4-21
string, 4-15
MkDir function, 5-270
MKtime function, 5-195
MML statement, 4-3
String2Long, 5-186
StrpTime function, 5-198
T
task management function, 5-290
Time function, 5-190, 5-199
ToString, 5-189
tuple, 4-21
tuple of Time function, 5-193
type conversion function, 4-29, 5-184
P
Print function, 5-207
R
RadioBoxGroup function, 5-284
read function, 5-267
Remove function, 5-271
RemoveDris function, 5-274
Rename function, 5-272
RmDir function, 5-270
S
SendMail Function, 5-301
sequence, 4-12
Sequence2List, 5-188
Sequence2Tuple, 5-187
SetOutFileName function, 5-206
SetOutFlag function, 5-205
SetOutMode function, 5-204
SetPassive function, 5-215
ShowForm function, 5-287
simple statement, 4-3
Sleep function, 5-196
Space function, 5-286
StrfTime function, 5-197
string, 4-15
string conversion function, 4-29
string format, 4-5
String2Float, 5-185
String2Int, 5-184
i-2
Issue 01 (20081208)