Isstar Uddddser Guide(v200r008_01)

March 25, 2018 | Author: aykutyilmaz2 | Category: Scripting Language, Trademark, Proprietary Software, Application Software, Computer File


Comments



Description

M2000V200R008 iSStar User Guide Issue 01 Date 2008–12–08 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Huawei Technologies Co., Ltd. provides customers with comprehensive technical support and service. For any assistance, please contact our local office or company headquarters. Huawei Technologies Co., Ltd. Address: Huawei Industrial Base Bantian, Longgang Shenzhen 518129 People's Republic of China Website: http://www.huawei.com Email: [email protected] Copyright © Huawei Technologies Co., Ltd. 2008. All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means without prior written consent of Huawei Technologies Co., Ltd. Trademarks and Permissions and other Huawei trademarks are the property of Huawei Technologies Co., Ltd. All other trademarks and trade names mentioned in this document are the property of their respective holders. Notice The 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. i M2000 iSStar User Guide Contents 3.3.6 Monitoring the Process of Running a Script........................................................................................3-26 3.4 Managing Scripts...........................................................................................................................................3-30 3.4.1 Viewing the Script Application Information........................................................................................3-31 3.4.2 Downloading a Script Application to the Local Terminal...................................................................3-32 3.4.3 Issuing a Script Application to the Server............................................................................................3-33 3.4.4 Deleting a Script Application...............................................................................................................3-34 3.4.5 Managing Script Application Bookmarks............................................................................................3-35 4 HSL Reference............................................................................................................................ 4-1 4.1 HSL Syntax.....................................................................................................................................................4-2 4.1.1 Identifier.................................................................................................................................................4-2 4.1.2 Keywords...............................................................................................................................................4-3 4.1.3 Statement................................................................................................................................................4-3 4.1.4 Operator..................................................................................................................................................4-4 4.1.5 String Format..........................................................................................................................................4-5 4.1.6 Comment................................................................................................................................................4-6 4.1.7 Condition................................................................................................................................................4-7 4.1.8 Loop.......................................................................................................................................................4-7 4.1.9 Function..................................................................................................................................................4-9 4.2 Data Types and Methods in the HSL............................................................................................................4-10 4.2.1 Number.................................................................................................................................................4-10 4.2.2 Sequence...............................................................................................................................................4-12 4.2.3 Dictionary.............................................................................................................................................4-22 4.2.4 File........................................................................................................................................................4-24 4.3 HSL Built-In Function..................................................................................................................................4-28 4.3.1 List of Built-In Functions.....................................................................................................................4-29 4.3.2 Example of Data Operation Function...................................................................................................4-32 4.3.3 Example of Type Conversion Function...............................................................................................4-33 4.3.4 Example of Other Functions................................................................................................................4-34 5 HFC Library Reference..............................................................................................................5-1 5.1 NE Operation Function...................................................................................................................................5-3 5.1.1 Overview of NE Operation Function.....................................................................................................5-4 5.1.2 Function: ConnectNE.............................................................................................................................5-6 5.1.3 Function: GetNELst...............................................................................................................................5-8 5.1.4 Function: GetNELstByType..................................................................................................................5-8 5.1.5 Function: GetNEName...........................................................................................................................5-9 5.1.6 Function: GetNEFDN..........................................................................................................................5-10 5.1.7 Function: GetNEIP...............................................................................................................................5-11 5.1.8 Function: GetNEVer............................................................................................................................5-13 5.1.9 Function: GetNEType..........................................................................................................................5-14 5.1.10 Function: GetNEStatus.......................................................................................................................5-15 5.1.11 Function: SendMML..........................................................................................................................5-16 5.1.12 Function: GetMMLReport.................................................................................................................5-17 ii Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide Contents 5.1.13 Function: GetAllMMLReport............................................................................................................5-20 5.1.14 Function: ClearMMLBuffer...............................................................................................................5-22 5.1.15 Function: SetMMLBufferSize............................................................................................................5-23 5.1.16 Example of NE Operation Function...................................................................................................5-24 5.2 MML Message Parsing Function..................................................................................................................5-27 5.2.1 Overview of MML Message Parsing Function....................................................................................5-29 5.2.2 MML Message Format.........................................................................................................................5-33 5.2.3 Function: ParseMMLRpt......................................................................................................................5-36 5.2.4 Function: GetSourceName...................................................................................................................5-37 5.2.5 Function: GetReportDate.....................................................................................................................5-39 5.2.6 Function: GetReportTime....................................................................................................................5-40 5.2.7 Function: GetTimeAdjustFlag..............................................................................................................5-41 5.2.8 Function: GetServiceFlag.....................................................................................................................5-42 5.2.9 Function: GetReportIdx........................................................................................................................5-43 5.2.10 Function: GetMMLCmd....................................................................................................................5-45 5.2.11 Function: GetResultCode...................................................................................................................5-46 5.2.12 Function: GetResultCause..................................................................................................................5-47 5.2.13 Function: GetObjNum........................................................................................................................5-48 5.2.14 Function: GetObjTitle........................................................................................................................5-50 5.2.15 Function: GetRecordNum..................................................................................................................5-51 5.2.16 Function: GetTips...............................................................................................................................5-52 5.2.17 Function: GetAttrValueByName........................................................................................................5-53 5.2.18 Function: GetAttrValueByIdx............................................................................................................5-55 5.2.19 Function: GetAttrNameList................................................................................................................5-56 5.2.20 Function: GetAttrNum.......................................................................................................................5-57 5.2.21 Function: GetColumnByName...........................................................................................................5-58 5.2.22 Function: GetColumnByIndex...........................................................................................................5-60 5.2.23 Function: GetRowByIndex................................................................................................................5-61 5.2.24 Function: GetDataFrmMMLRpt........................................................................................................5-63 5.2.25 Function: DestroyMMLParser...........................................................................................................5-65 5.2.26 Examples of MML Message Parsing Function..................................................................................5-66 5.3 Alarm Message Parsing Function.................................................................................................................5-68 5.3.1 Overview of Alarm Message Parsing Function...................................................................................5-71 5.3.2 Alarm Message Format........................................................................................................................5-75 5.3.3 Function: ParseAlmRpt........................................................................................................................5-78 5.3.4 Function: GetAlmSource......................................................................................................................5-80 5.3.5 Function: GetAlmRptDate...................................................................................................................5-81 5.3.6 Function: GetAlmRptTime..................................................................................................................5-82 5.3.7 Function: GetAlmRptNum...................................................................................................................5-84 5.3.8 Function: GetAlmServiceTag..............................................................................................................5-85 5.3.9 Function: GetAlmTimeAdjustFlag......................................................................................................5-86 5.3.10 Function: GetAlmServiceFlag............................................................................................................5-87 Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. iii M2000 iSStar User Guide Contents 5.3.11 Function: GetAlmRptIdx....................................................................................................................5-88 5.3.12 Function: GetAlmMMLCmd.............................................................................................................5-89 5.3.13 Function: GetAlmResultCode............................................................................................................5-91 5.3.14 Function: GetAlmResultCause...........................................................................................................5-92 5.3.15 Function: GetAlmTips........................................................................................................................5-93 5.3.16 Function: GetAlmFlowNumber.........................................................................................................5-94 5.3.17 Function: GetAlmType......................................................................................................................5-95 5.3.18 Function: GetAlmLevel......................................................................................................................5-97 5.3.19 Function: GetAlmNEType.................................................................................................................5-98 5.3.20 Function: GetAlmID..........................................................................................................................5-99 5.3.21 Function: GetAlmSort......................................................................................................................5-101 5.3.22 Function: GetAlmSyncSerialNo......................................................................................................5-102 5.3.23 Function: GetAlmName...................................................................................................................5-104 5.3.24 Function: GetAlmRaiseTime...........................................................................................................5-105 5.3.25 Function: GetAlmLocationInfo........................................................................................................5-106 5.3.26 Function: GetAlmAttrValueByName..............................................................................................5-108 5.3.27 Function: GetAlmAttrValueByIdx...................................................................................................5-110 5.3.28 Function: GetAlmNumByLevel.......................................................................................................5-111 5.3.29 Function: GetAlmNumByTimeDur.................................................................................................5-113 5.3.30 Examples of Alarm Message Parsing Function...............................................................................5-114 5.4 Database Operation Function......................................................................................................................5-116 5.4.1 Overview of Database Operation Functions......................................................................................5-118 5.4.2 Function: OpenDB.............................................................................................................................5-121 5.4.3 Function: CreateCond........................................................................................................................5-122 5.4.4 Function: QueryFmRcds....................................................................................................................5-124 5.4.5 Function: NextFmRcds......................................................................................................................5-130 5.4.6 Function: QueryPmRcds....................................................................................................................5-136 5.4.7 Function: NextPmRcds......................................................................................................................5-141 5.4.8 Function: QueryCmRcds....................................................................................................................5-143 5.4.9 Function: NextCmRcds......................................................................................................................5-144 5.4.10 Function: GetCmCom......................................................................................................................5-145 5.4.11 Function: GetChildMoc....................................................................................................................5-146 5.4.12 Function: GetIntegrityReportCond..................................................................................................5-147 5.4.13 Function: GetFunctionSubSetList....................................................................................................5-149 5.4.14 Function: QueryIntegrityResult........................................................................................................5-150 5.4.15 Function: GetOneNEInteLst............................................................................................................5-151 5.4.16 Function: GetOneFssInte..................................................................................................................5-152 5.4.17 Function: GetOneIntegrity...............................................................................................................5-153 5.4.18 Function: GetPmCond......................................................................................................................5-154 5.4.19 Function: GetFmCond......................................................................................................................5-156 5.4.20 Function: QueryRecord....................................................................................................................5-161 5.4.21 Function: RecordCount....................................................................................................................5-163 iv Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide Contents 5.4.22 Function: NextRecord......................................................................................................................5-164 5.4.23 Function: GetMocAttrNameList......................................................................................................5-169 5.4.24 Function: GetMocList......................................................................................................................5-170 5.4.25 Function: GetNeObjInfo..................................................................................................................5-170 5.4.26 Function: GetCounterInfo................................................................................................................5-171 5.4.27 Function: GetFuncSetList................................................................................................................5-172 5.4.28 Function: GetFuncSubSetList..........................................................................................................5-173 5.4.29 Function: GetMoiAttrValueList.......................................................................................................5-174 5.4.30 Function: GetMoiListByFilter..........................................................................................................5-175 5.4.31 Function: GetPmNeType..................................................................................................................5-177 5.4.32 Function: GetNeInfo........................................................................................................................5-178 5.4.33 Function: CloseDB...........................................................................................................................5-179 5.5 Alarm Operation Function..........................................................................................................................5-180 5.5.1 Overview of Alarm Operation Function............................................................................................5-180 5.5.2 Function: SendAlarm.........................................................................................................................5-180 5.6 OM Operation Function..............................................................................................................................5-181 5.6.1 Overview of OM Operation Function................................................................................................5-182 5.6.2 Function: GetOMCVersion................................................................................................................5-182 5.6.3 Function: LOG_OP............................................................................................................................5-183 5.7 Type Conversion Function..........................................................................................................................5-184 5.7.1 Function: String2Int...........................................................................................................................5-184 5.7.2 Function: String2Float........................................................................................................................5-185 5.7.3 Function: String2Long.......................................................................................................................5-186 5.7.4 Function: Sequence2Tuple.................................................................................................................5-187 5.7.5 Function: Sequence2List....................................................................................................................5-188 5.7.6 Function: ToString.............................................................................................................................5-189 5.8 Time Function.............................................................................................................................................5-190 5.8.1 Overview of Time Function...............................................................................................................5-191 5.8.2 Time Format.......................................................................................................................................5-192 5.8.3 Time Tuple.........................................................................................................................................5-193 5.8.4 Function: GMTime.............................................................................................................................5-194 5.8.5 Function: LocalTime..........................................................................................................................5-194 5.8.6 Function: MkTime..............................................................................................................................5-195 5.8.7 Function: Sleep...................................................................................................................................5-196 5.8.8 Function: StrfTime.............................................................................................................................5-197 5.8.9 Function: StrpTime............................................................................................................................5-198 5.8.10 Function: Time.................................................................................................................................5-199 5.8.11 Function: CTime..............................................................................................................................5-199 5.8.12 Function: AscTime...........................................................................................................................5-200 5.9 Input and Output Function..........................................................................................................................5-201 5.9.1 Overview of Input and Output Functions...........................................................................................5-202 5.9.2 Function: UserInput............................................................................................................................5-202 Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. v M2000 iSStar User Guide Contents 5.9.3 Function: UserOutput.........................................................................................................................5-203 5.9.4 Function: SetOutMode.......................................................................................................................5-204 5.9.5 Function: SetOutFlag.........................................................................................................................5-205 5.9.6 Function: SetOutFileName.................................................................................................................5-206 5.9.7 Function: Print....................................................................................................................................5-207 5.9.8 Function: GetOutputPath....................................................................................................................5-208 5.9.9 Function: NotifyProgress...................................................................................................................5-209 5.10 GetError Function.....................................................................................................................................5-210 5.10.1 Overview of GetError Function.......................................................................................................5-210 5.10.2 Function: GetLastError....................................................................................................................5-210 5.10.3 Function: GetErrorMsg....................................................................................................................5-211 5.10.4 Examples of GetError Function.......................................................................................................5-212 5.11 Network Operation Function.....................................................................................................................5-213 5.11.1 Overview of Network Operation Function.......................................................................................5-214 5.11.2 Function: SetPassive........................................................................................................................5-215 5.11.3 Function: LoginFTP.........................................................................................................................5-216 5.11.4 Function: Upload..............................................................................................................................5-216 5.11.5 Function: Download.........................................................................................................................5-217 5.11.6 Function: GetFTPStatus...................................................................................................................5-218 5.11.7 Function: LogoutFTP.......................................................................................................................5-219 5.11.8 OpenTelnet Function........................................................................................................................5-219 5.11.9 ExecuteCmd Function......................................................................................................................5-220 5.11.10 IsConnected Function.....................................................................................................................5-221 5.11.11 CloseTelnet Function.....................................................................................................................5-221 5.11.12 Example of Network Operation Function......................................................................................5-222 5.12 Report Operation Function........................................................................................................................5-224 5.12.1 Overview of Report Operation Function..........................................................................................5-225 5.12.2 Report Design Function...................................................................................................................5-226 5.12.3 Report Display Function..................................................................................................................5-242 5.12.4 Report Management Function..........................................................................................................5-255 5.12.5 Parameters for Operating Report......................................................................................................5-259 5.12.6 Examples of Report Operation Function..........................................................................................5-262 5.13 Directory Operation Function...................................................................................................................5-264 5.13.1 Overview of Directory Operation Function.....................................................................................5-265 5.13.2 Function: Open.................................................................................................................................5-266 5.13.3 Function: read...................................................................................................................................5-267 5.13.4 Function: write.................................................................................................................................5-268 5.13.5 Function: close.................................................................................................................................5-269 5.13.6 Function: MkDir...............................................................................................................................5-270 5.13.7 Function: RmDir..............................................................................................................................5-270 5.13.8 Function: GetCwd............................................................................................................................5-271 5.13.9 Function: Remove............................................................................................................................5-271 vi Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide Contents 5.13.10 Function: Rename..........................................................................................................................5-272 5.13.11 Function: ListDir............................................................................................................................5-273 5.13.12 Function: MakeDirs........................................................................................................................5-274 5.13.13 Function: RemoveDirs...................................................................................................................5-274 5.13.14 Examples of Directory Operation Function...................................................................................5-275 5.14 GUI Interactive Library Function.............................................................................................................5-276 5.14.1 Overview of GUI Interactive Library Function...............................................................................5-276 5.14.2 Introduction to GUI Interactive Library Controls............................................................................5-278 5.14.3 Function: CreateForm......................................................................................................................5-280 5.14.4 Function: Label................................................................................................................................5-281 5.14.5 Function: Edit...................................................................................................................................5-282 5.14.6 Function: CheckBox.........................................................................................................................5-283 5.14.7 Function: RadioBoxGroup...............................................................................................................5-284 5.14.8 Function: Enter.................................................................................................................................5-285 5.14.9 Function: Space................................................................................................................................5-286 5.14.10 Function: ShowForm......................................................................................................................5-287 5.14.11 Function: GetValue........................................................................................................................5-288 5.14.12 Function: DeleteForm....................................................................................................................5-289 5.14.13 Examples of GUI Interactive Library Function.............................................................................5-290 5.15 Task Management Function......................................................................................................................5-290 5.15.1 Overview of Task Management Function........................................................................................5-291 5.15.2 Function: CreateTask.......................................................................................................................5-291 5.15.3 Function: Wait..................................................................................................................................5-292 5.15.4 Function: GetRegisterKey................................................................................................................5-293 5.15.5 Function: Exit...................................................................................................................................5-294 5.16 Assertion Function....................................................................................................................................5-295 5.16.1 Overview of Assertion Function......................................................................................................5-295 5.16.2 Function: Assert...............................................................................................................................5-295 5.16.3 Function: Assert_ON........................................................................................................................5-296 5.16.4 Function: Assert_OFF......................................................................................................................5-297 5.17 Mail Sending Function..............................................................................................................................5-297 5.17.1 Function: CreateLoginInfo...............................................................................................................5-297 5.17.2 Function: CreateMailInfo.................................................................................................................5-299 5.17.3 Function: SendMail..........................................................................................................................5-301 Index.................................................................................................................................................i-1 Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. xi M2000 iSStar User Guide Tables Table 5-2 MML message parsing functions.......................................................................................................5-30 Table 5-3 Description of MML message format................................................................................................5-33 Table 5-4 Alarm message parsing function list..................................................................................................5-71 Table 5-5 Description of the Alarm Message Format........................................................................................5-76 Table 5-6 Database operation function list.......................................................................................................5-119 Table 5-7 Description of items in Fmcond.......................................................................................................5-124 Table 5-8 Attributes of alarm data records.......................................................................................................5-131 Table 5-9 Description of items of Pmcond.......................................................................................................5-137 Table 5-10 Description of conditions for querying performance data.............................................................5-154 Table 5-11 Description of conditions for querying alarm data.........................................................................5-157 Table 5-12 Items in the list of alarm records....................................................................................................5-165 Table 5-13 Items in the list of alarm records....................................................................................................5-167 Table 5-14 Alarm function list.........................................................................................................................5-180 Table 5-15 OM function list.............................................................................................................................5-182 Table 5-16 List of time functions.....................................................................................................................5-191 Table 5-17 List of input and output functions..................................................................................................5-202 Table 5-18 List of GetError functions..............................................................................................................5-210 Table 5-19 Description of error information....................................................................................................5-212 Table 5-20 Description of error level ..............................................................................................................5-212 Table 5-21 FTP function list.............................................................................................................................5-214 Table 5-22 telnet function list...........................................................................................................................5-214 Table 5-23 Report operation function list.........................................................................................................5-225 Table 5-24 Example of Using Conditional Expressions..................................................................................5-235 Table 5-25 Meanings of optional colors...........................................................................................................5-259 Table 5-26 Description of optional font values................................................................................................5-261 Table 5-27 Type Description............................................................................................................................5-262 Table 5-28 List of directory operation functions..............................................................................................5-265 Table 5-29 List of GUI interactive library functions........................................................................................5-277 Table 5-30 GUI interactive library controls.....................................................................................................5-278 Table 5-31 Layout of the controls....................................................................................................................5-279 Table 5-32 Return values..................................................................................................................................5-288 Table 5-33 List of task management functions................................................................................................5-291 Table 5-34 List of assertion functions..............................................................................................................5-295 xii Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide About This Document About This Document 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 Technical support engineers l Maintenance engineers Update History 01(2008-12-08) This is the first formal release. Brief Introduction Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1 M2000 iSStar User Guide 1 iSStar Overview 1 iSStar Overview About This Chapter Being an enhanced tool component of the M2000, Integration Script Star (iSStar) is a powerful script secondary development platform. The iSStar provides an easy-to-learn programmable script language - High level Script Language (HSL), powerful High-level Foundation Classes (HFC), and an integrated development environment for editing, debugging, and executing the HSL scripts. You can create an HSL script for the repetitive and effort-consuming daily maintenance. In this way, daily maintenance can be performed automatically through the iSStar tool. This reduces workload and improves work efficiency. 1.1 Product Features of iSStar The iSStar has all the features that a secondary development platform should have. After you understand these features, you will have a preliminary knowledge about the iSStar. 1.2 Basic Concepts of iSStar The iSStar has its unique concepts. The basic concepts of the iSStar involve script, script development platform, script application platform, user, and script project. These concepts help you better understand the iSStar. 1.3 iSStar Application Scenarios The iSStar is a secondary development platform for users to extend the operation and maintenance of the service functions. Users can perform secondary development in the iSStar secondary platform as required. This secondary platform is used where there is need for bulk operations or routine and automatic executions. The iSStar is complementary to the M2000 system. 1.4 iSStar Software Architecture The iSStar is a subsystem of the M2000, respects the architecture design of the M2000, and is classified into client system and server system. With regards to function modules, the iSStar software system is composed of GUI subsystem, executor (descriptor) subsystem, HFC subsystem, ScriptServer subsystem, and service subsystem. 1.5 Functions of iSStar The iSStar provides the HSL, an integrated development environment for editing, debugging, and running HSL scripts, and functions of managing script applications and script tasks. 1.6 iSStar Script Sample Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview 1.1 Product Features of iSStar The iSStar has all the features that a secondary development platform should have. After you understand these features, you will have a preliminary knowledge about the iSStar. As a powerful secondary development platform, the iSStar has the following features: l The iSStar provides powerful script program development capability and can flexibly customize personalized service. The HSL can be used to write multiple kinds of programs because its syntax is based on Python. In addition, the HSL has its own data types and functions and has good control over the MML scripts through compiling. The HSL can customize personalized services as required for fast service deployment. l The iSStar provides abundant extendable service functions. The iSStar provides abundant extendable HSL Foundation Class (HFC). The HFC encapsulates many complex and similar service implementations into functions. To compile a script program in the iSStar, you only need to invoke these functions. You can flexibly extend HFC as required. l The iSStar provides a comprehensive program debugging mechanism. The iSStar provides a comprehensive program debugging mechanism. For example, you can set breakpoints and one-step debugging for the script programs. Thus, you can debug the program to check whether the program runs properly and can quickly locate the problems of the program. l You can compile MML scripts in batches through the iSStar. By compiling the MML script program, you can conveniently deliver batch MML commands and can perform batch operations on multiple NEs. l Script tasks can be automatically executed. The script programs support manual immediate execution and timing automatic execution. Tasks that are executed in certain time point or periodically executed can be set as timing tasks. The script automatically executes these tasks. l The iSStar provides an user-friendly interface. You can follow the wizard to edit, compile, and execute scripts. The result of the script execution is displayed in the monitoring window in real time. 1.2 Basic Concepts of iSStar The iSStar has its unique concepts. The basic concepts of the iSStar involve script, script development platform, script application platform, user, and script project. These concepts help you better understand the iSStar. Table 1-1 describes the basic concepts involved in the iSStar. Table 1-1 Basic concepts involved in the iSStar Basic Concepts Description Script Programs written in the HSL are used to provide specific service functions. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 Indicates the platform for developing service function scripts. The development platform provides the functions of managing projects and editing, debugging, and running scripts. 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. l Service users Those who are concerned with only the execution of scripts and the implementation of a service function are called service users. Service users often use the application platform. Service users are also called application users. Script project Script projects are used by developers for centrally managing scripts with associated functions. A group of script files in the development platform are organized as a project. Each script project corresponds to a script project file. The extension name of a script project file is .dsl. A script project file records the information about scripts and the main file of a script project. The main file is the execution entry for executing and debugging a script project. A script project is the basis for packing. Script application Script application indicates the script application package. A script application is a set of script files that meet specific service requirements, and is generated from packing of a script project. Through script applications, if the script application does not support the unpacking function, development users can hide the implementation details of the service from service users. Service users need not care about the implementation details of the service and only care about the service operation and related functions. Script applications are classified into local script applications and remote script applications. Local script application files are stored and run in the client. Remote script application files are stored and run in the server. 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview Basic Concepts Description Script application bookmark A script application bookmark is related to a script application program and is the execution entry of the script application program. The bookmark is represented as an icon in the iSStar platform. 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. 1.3 iSStar Application Scenarios The iSStar is a secondary development platform for users to extend the operation and maintenance of the service functions. Users can perform secondary development in the iSStar secondary platform as required. This secondary platform is used where there is need for bulk operations or routine and automatic executions. The iSStar is complementary to the M2000 system. Background The OM personnel of the carriers often face the following problems and challenges during their work: l The functions provided by the network management system fail to meet the carrier's requirements for personalized operation and maintenance. The operation and maintenance service functions of the network management system provided by the equipment vendor are general functions that meet most carriers' requirements in most OM scenarios and are tailored to the customers' usage habits. When a carrier has a personalized and unique OM requirement, the equipment vendor fails to respond quickly to meet the customer's requirement due to the limits of software development period and version release period. l Expansion of the network scale leads to drastic increase of the OM work. With the business development, the network size expands quickly and the maintenance work increases accordingly. Operations on NEs one by one cannot meet the challenge. You can deliver batch instructions to multiple NEs. Implementing a service function can help improve the OM efficiency. l Issue 01 (2008–12–08) Too many manual routine maintenance operations should be performed and some operations are duplicated. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. Typical Application Scenarios Script programs enable you to perform the operations on the NEs in batches. They can be executed manually or automatically through timing tasks. For example, you can use the iSStar to perform the tasks such as routine check, real-time monitoring, office data creation, and bulk configuration data delivery. Routine Check l Target users: Staff in the OM team and the monitoring team l Scenario description Routine check is a common task in daily OM. You need to check the key operation state or network parameters of the devices on the existing network. Then, you can identify whether the device is running properly and can detect the potential or existing faults. By compiling the iSStar script program, you can send MML commands to the corresponding NEs to check the operational state of the devices. The generated check report summarizes and lists the exceptions. l Reference <Installation directory on the M2000 client>\script\samples\en\DailyCheck\sample.hsl Real-Time Monitoring l Target users: Staff in the monitoring team l Scenario Description You can write an iSStar script about the network monitoring tasks that are required every day. By irregularly executing or periodically executing the script with a short interval, the iSStar notifies the operators of the exceptions through alarms or exceptional files. Though not recommended, the scripts can also be executed circularly. In this way, OM engineers can obtain the information about the network in real time. NOTE The real-time network monitoring provided by iSStar supplements the alarm module on the M2000. Compared with the alarm module, the monitoring program written by the iSStar is used for specific purposes. Data Creation l Target users: Softswitch equipment maintenance personnel l 1-6 Scenario Description Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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. Batch Configuration Data Delivery l Target users: Staff in the configuration team l 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. Analysis of Performance and Alarm Data l Target users: Staff in the professional maintenance team l 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. 1.4 iSStar Software Architecture The iSStar is a subsystem of the M2000, respects the architecture design of the M2000, and is classified into client system and server system. With regards to function modules, the iSStar software system is composed of GUI subsystem, executor (descriptor) subsystem, HFC subsystem, ScriptServer subsystem, and service subsystem. The client focuses on compiling and debugging scripts, while the server focuses on running and scheduling tasks. Figure 1-1 shows the system deployment of the iSStar. Figure 1-1 iSStar system deployment Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1-7 M2000 iSStar User Guide 1 iSStar Overview The functions of each subsystem are as follows: l GUI subsystem: consists of development platform and application platform. The development platform is used to compile and edit scripts and focuses on compiling and development. The application platform provides a function that uses the services through script application and focuses on management and interaction. l Executor (descriptor) subsystem: parses scripts and executes and controls tasks. l HFC subsystem: provides a group of encapsulated service functions for script developers. l ScriptServer subsystem: schedules and executes remote tasks. l Service subsystem: provides a group of service scripts and script project packages for users. 1.5 Functions of iSStar The iSStar provides the HSL, an integrated development environment for editing, debugging, and running HSL scripts, and functions of managing script applications and script tasks. 1.5.1 Script File Development The iSStar provides a main window, a debugging window, and a running window, where you can edit, debug, and run HSL scripts. 1.5.2 Script Application Management For users who are only concerned with executing scripts to provide a service function, the users can directly use iSStar Application Management provided by iSStar. Users can manage the script application through iSStar Application Management without caring about implementation details of the script. 1.5.3 Script Task Management When you execute a script file, script project, or script application to implement a specific service function, the iSStar creates a task. You can view the basic information and execution of all the local tasks and remote tasks of the system in the iSStar Task Manage Window window and can control the execution of the tasks. 1.5.4 HSL Language The High-level Script Language (HSL) is an easy-to-learn and powerful script language provided by the iSStar. The features of the HSL are simple and efficient syntax, abundant data types, and efficient and extendable library functions. 1.5.1 Script File Development The iSStar provides a main window, a debugging window, and a running window, where you can edit, debug, and run HSL scripts. iSStar Main Window The iSStar Main Window provides an environment for creating, compiling, and editing scripts. Figure 1-2 shows the interface. For details of the functions of Figure 1-2, refer to Table 1-2. NOTE 1-8 l In the main window, you can manage multiple script files. The number of script files, however, must be less than 100. l Each script is displayed as a tab page. The tab page displays the script name. The information output area of the window displays the output information of the script file. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview Figure 1-2 iSStar Main Window Table 1-2 Description of iSStar Main Window Area Description Project management area Provides a function for creating and editing projects. Information output area l Syntax Check tab Displays the syntax check information for script file running and debugging. l Task Log tab Displays the log information of the task management operations. The task management operations include creating, running, debugging, and deleting operations. Script editing area Provides script development, editing, and breakpoints. The common edit functions include copying, cutting, pasting, finding, replacing, printing, undoing, redoing, locating line number, and setting bookmarks. For details, see 3.2.1 Creating a Script File. The breakpoint function includes setting and deleting breakpoints and is used for script debugging. For details, see 3.2.2 Debugging a Script File. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 Provides the common script operations: l : exits and closes the iSStar. l : creates a script file. l : opens an existing script file. l : saves a script file. l : saves a script file into another file. l : prints a script file. l : cuts a script. l : copies a script. l : pastes a script. l l : runs a task. You can also run a specific part of a script file. : debugs a task. l : checks the syntax of a script file. The result of syntax check is displayed in the information output area. Click the error message (including the file name, details, and line number), if any, and then you can see the icon located besides the error line. l : Switches the window to iSStar Task Manage Window to display the execution of the tasks. l : to select the NEs required by the program. l : Select multiple NEs to create tasks in batches. l : Start the Task Management window. iSStar Debug window The iSStar Debug Window provides an environment for debugging scripts and discovering script errors. Figure 1-3 shows the interface. Table 1-3 describes Figure 1-2. 1-10 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview CAUTION l The iSStar allows only one debugging task. l A maximum of 50 debugging tasks and running tasks can be supported by the iSStar. Figure 1-3 iSStar Debug window Table 1-3 Description of iSStar Debug Window Area Description Tool bar Provides shortcut icons for debugging operation and switching windows. Display area Issue 01 (2008–12–08) l : switches the window to iSStar Main Window so that you can edit the script file according to the debugging result. l : switches the window to iSStar Task Manage Window to display the execution of the tasks. Displays the content of the current script. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. Table 1-4 Description of the output area Name Description Message l The Message tab page displays the system information during the debugging of the script files. The system information includes script debugging output information, script running output information, error information, and syntax check results. l The output information is exported to Message line by line. When the number of the lines exceeds 3000, the first 1000 messages are deleted. l On the Message tab page, right-click the output information to copy, clear, search, save as, or redirect the output information. NOTE Redirection involves saving the script output information to the file under the specified path. Redirection saves all the output information of the scripts that have performed the redirection. MML Response l The MML Response tab page contains the MML commands and displayed information during the running and debugging of the script file. If the running commands include commands of follow-up reports, multiple MML reports with the same ID are returned. l The MML Response tab page displays a maximum of 3000 message lines. If the number exceeds the limit, the earliest 1000 messages are deleted. l On the MML Response tab page, right-click the output information to copy, clear, search, save as, and redirect the output information. NOTE Redirection means to save the script output information to the file under the specified path. Redirection saves only all the output information after the redirection. 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 l When debugging succeeds, the Stack tab page displays the full path information invoked by the current function. l The stack information is refreshed as the script file is executed. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview Name Description Watch l The Watch tab page displays the change information of the variables during the debugging of the script file. l On the Watch tab page, right-click the variable to be observed to add or delete it. NOTE l The Watch tab page displays a maximum of 32 watched variables. l If the selected variable has spaces before or after the name, the space(s) is deleted after being added to the tab. l The variable name can be copied, modified, and deleted. The variable value cannot be edited. l In the display area of iSStar Debug Window, right-click a variable and select Add to Watch to add a watched variable. l When you stop debugging, no messages are displayed on Watch. iSStar Execute Window iSStar Execute Window provides an environment for running scripts and displaying script output. l Figure 1-4 shows the running window displayed when a script file invokes the GUI interactive library function. l 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. l For description of the script running window, see Table 1-5. l Each script task corresponds to a script running window. l The system supports a maximum of 50 debugging tasks and running tasks. But the system supports only one debugging task. Figure 1-4 iSStar Execute Window Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1-13 M2000 iSStar User Guide 1 iSStar Overview Figure 1-5 iSStar Execute Window 1-14 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview Table 1-5 Description of iSStar Execute Window Area Description Tool bar Provides control buttons for executing scripts. The meanings for the buttons are as follows: l : stops a task that you are executing. If a script file is already executed, this button appears dimmed. l : re-executes a script, project, or task. l : pauses an executing task. After the script file execution is paused, the button changes to execution of the script file. l l . Click this button to resume the : displays the folder of the default output file of a task. : closes iSStar Execute Window. l : switches from executing window to editing window. When a task is being executed, you can click the button to switch to the iSStar Main Window to edit the script file. Then you can edit the script file being executed. l : switches from executing window to task management window. When a task is being executed, click this button to switch to iSStar Task Manage Window to display the basic information and execution of the task. Print output area Displays the output of the print function of the script file. MML message output area Displays the MML command and return information during the execution of a script. MML command statistic bar Counts and displays the number of MML command deliveries, number of execution successes, and number of execution failures of the script file. 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. 1.5.2 Script Application Management For users who are only concerned with executing scripts to provide a service function, the users can directly use iSStar Application Management provided by iSStar. Users can manage the script application through iSStar Application Management without caring about implementation details of the script. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 Table 1-6 Description of the iSStar Application Management window Area 1-16 Description Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview Tool bar Displays the shortcut icons for the management of applications. l : adds a workstation. l : to add shortcuts. l : to delete shortcuts. l : to run the programs of the selected shortcuts. l : to view or modify the attributes of the selected shortcuts. l : releases files. You can upload files to the server. l : to download files. You can download the programs corresponding to the selected remote shortcuts to the local computer. l : to delete remote files. You can delete the programs corresponding to the selected remote shortcuts. l : to manage remote files. You can view the information about the programs on the server. In addition, you can upload and download programs. l l l Workspace : to select the NEs required by the program. : to create tasks in batches. You can select multiple NEs to create tasks in batches. : Start the Task Management window. In the iSStar, the tab page of the iSStar Application Management window is called workspace. You can create a workspace or create script applications in the workspace. NOTE A workspace can store less than 70 bookmarks. A maximum of 10 workspaces can be created. Shortcut A bookmark is related to a script application and is the entrance for execution of the script application. A bookmark is displayed as an icon in the iSStar Application Management window. 1.5.3 Script Task Management When you execute a script file, script project, or script application to implement a specific service function, the iSStar creates a task. You can view the basic information and execution of all the local tasks and remote tasks of the system in the iSStar Task Manage Window window and can control the execution of the tasks. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1-17 M2000 iSStar User Guide 1 iSStar Overview iSStar Task Manage Window Figure 1-7 shows the iSStar Task Manage Window window. Table 1-7 describes each area on the interface shown in Figure 1-7. Figure 1-7 iSStar Task Manage Window Table 1-7 Description of the parameters of iSStar Task Manage Window Parameter/Tab Description Local Task tab Click the Local Task tab to view the basic information and execution results of all the local script tasks in the system. NOTE The files of local tasks are saved and executed on the local computer. Remote Task tab Click the Remote Task tab to view the basic information and execution result of all the remote script tasks in the system. NOTE l The files of remote tasks are saved and executed on the server. l By creating remote script tasks, you can share the services. 1-18 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview Parameter/Tab Description Script File The parameter indicates the script entry for debugging and executing script tasks and script applications. Task Type The parameter indicates the classification of the script tasks, including Local TaskandRemote Task. State The parameter indicates the state of a running or debugging task. For details, see 3.3.1 Types and Status of Script Tasks. Process The parameter indicates the execution progress in a progress bar. NOTE Progress is described in scripts and fed back to the client. When the statement about the progress is executed, the progress bar displays the current progress in the script. If the statement about the progress is not configured in the script, the progress value is 0%. Start Time The parameter indicates the time when the task starts. End Time The parameter indicates the time when the task ends. Table 1-8 Shortcut buttons Shortcut Button 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. Functions of iSStar Task Manage Window iSStar Task Manage Window provides the following functions: Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. l Sorts tasks. You can sort the tasks by the fields, such as Script File to quickly locate the task that you want to view. l Switching from iSStar Task Manage Window to iSStar Main Window. Click to switch the window to iSStar Main Window so that you can edit the corresponding script file as required. l Controlling tasks, including creating, copying, deleting, running, pausing, resuming, and stopping a task. l Viewing the output information of the task, including viewing the print output and MML output. 1.5.4 HSL Language The High-level Script Language (HSL) is an easy-to-learn and powerful script language provided by the iSStar. The features of the HSL are simple and efficient syntax, abundant data types, and efficient and extendable library functions. Syntax Based on Python. The HSL syntax is based on Python. You need not compile and link. The programs are compact and easy-to-read and have good expandability. In terms of basic syntax, the HSL comes from Python. The HSL supports the following common functions: l Supports simple statements, such as assignment, variable, arithmetic expression, return statement, and continue statement. l Supports complex conditional control statements, such as if statement, while statement, and for statement. l Supports self-definition of functions. l Supports the import of library functions. l Supports the invoking of file functions. Supporting Batch MML Commands You can compile MML script for batch operations. The details are as follows: l You can connect to NEs. You can connect to an NE through the HFC functions in the script, or manually select an NE in the GUI. l You can send MML commands You can directly write batch MML commands in the script. l You can parse MML messages and alarm messages. You can use the corresponding functions provided by the HSL to parse MML messages and alarm messages. In this way, you can obtain the required information. Providing Continuous Expandable Service Function Library HFC. HFC is a series of functions for operating and maintaining service encapsulation. You can directly invoke these functions when compiling the HSL script. Using HFC can simplify the 1-20 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 HSL built-in function The HSL built-in function processes characters and data, and converts types. NE operation function The NE operation function connects NEs, issues commands, and obtains information about NEs. MML message parsing function The MML message parsing function parses MML messages. Alarm message parsing function The alarm message parsing function parses alarm messages. Database operation function The database operation module provides an interface for querying alarms, performance, and the configuration library. Alarm operation function The alarm operation function sends the information about exceptions detected during the script running. NMS Functions The network management operation function enables you to query the information about the release of the M2000 and generates operation logs. Time function The time function enables you to obtain information related to time and provides the function for converting time formats. Input and output function The input and output function provides the input and output function and enables you to set the output modes. GetError function The GetError function, which provides the unified handling function for error codes, enables you to obtain the last error information list and the error cause function. FTP operation function The FTP operation function enables you to upload or download files. Report operation function The report operation function enables you to create reports, add pages, add tables, edit tables, and save reports. Directory operation function The directory operation function enables you to create, modify, or delete directories. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1-21 M2000 iSStar User Guide 1 iSStar Overview Function Description GUI interactive function The GUI interactive function enables you to deploy simple controls for interaction with GUI during the task execution. Task management function The task management function enables you to manage tasks, which involves creating subtasks, and waiting for completion of sub-task. Assertion function The assertion function enables you to diagnose the statements. 1.6 iSStar Script Sample 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. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1-23 M2000 iSStar User Guide 1 iSStar Overview #Obtain the current MML command character string MMLCmd = GetMMLCmd (p) return DataList,MMLCmd end #Exception judging function def CheckValue(OneRow) RetLst = [] #Judge whether the value of a row in the report is exceptional , OneRow [4] means "CPU usage" OneRow[5] means "CPU status" if int(OneRow[4][:-1]) > 30 RetLst.append(4) end if OneRow[5] != 'normal' RetLst.append(5) end return RetLst end #~~~~~~~~~~~~~~~~~~~~~General function definition~~~~~~~~~~~~~~~~~~~~~ # Create a table in Excel and write data def writeTable (sheetID,tablename,row,col,header,datalst) if row < 0 or col < 0 return 0 end tableID= AddTable(sheetID,row+1,col,tablename) SetTableValue(tableID, header + datalst) SetTableTitleFont(tableID,8,10,0,1) SetTableFont(tableID,8,10,0,0) for i in range(col) SetCellBGColor(tableID,0,i,20) end return tableID end # Set column width def setColWidthList(sheetID,widths) for col in range (len(widths)) SetColumnWidth(sheetID,col,widths[col]) end end # Write data to Excel report def writeReport(sheetID, tablename, header, dataset, colwidths=[]) col = len(header) row = len(dataset) datalst = [] for item in dataset datalst.extend(item) end #row = len (datalst)/col tableID = writeTable(sheetID,tablename,row,col,header,datalst) if colwidths setColWidthList(sheetID,colwidths) end return tableID end # Get the values of some columns of the MML report def getColsByIdx(p, obj=0, attridxs=[]) cols = [] #Get specified row of the MML report row = GetRecordNum(p,obj) col = GetAttrNum(p, obj) if attridxs==[] attridxs = range(col) end for i in range(row) onecol = [] for j in attridxs if j > col value = NULL_VALUE else value = GetAttrValueByIdx(p,obj,j,i) end onecol.append(value) end cols.append(onecol) end return cols end #Format list type and output the data. Convert to character string def FormatList(datalst, sep=',' ) content = '' for data in datalst if content content += sep + str(data) else content += str(data) end end return content end ####################################--Function definition-end-#################################### ####################################--Program execution-begin-#################################### Main() Script Function and Basic Principle The script is used to implement a specific service function. The basic function of CPU load query script is to obtain the CPU load information, generate check report, and help maintenance personnel to check some important running states or network parameters of the existing network equipment to determine whether the equipment is normal. The basic principle is that by sending MML command to NEs to obtain messages that include the CPU load information, you can analyze the returned messages for exception information and make a judgment depending on the actual exception. Script File Structure When lot of complex functions should be implemented by the services, you can classify services into sub services and define these services as functions. Thus, the script organization is clear 1-24 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 The main function of the script is the execution entry of the script and is responsible for organizing other functions and for controlling the execution flow of the script. The main function invokes other self-defined functions and HFC library functions to provide control of the execution flow of the script. ExecMMLCmd function This function is used to send MML messages and obtain CPU load information. By sending the MML command @DSP CPUR:; to an NE, this function gets the message, and then analyzes the message by invoking 5.1.12 Function: GetMMLReport, 5.2.3 Function: ParseMMLRpt, 5.2.11 Function: GetResultCode, and 5.2.12 Function: GetResultCause. CheckValue function This function is used to analyze the exception and get CPU usage that is larger than 30 and the CPUs whose state is exceptional. This function analyzes the values the list items. For knowledge about list, see List. writeTable function This function is used to create a new table in the Excel table, write data, and set the display style of the table. The function invokes Function: AddTable, Function: SetTableValue, Function: SetTableTitleFont, Function: SetTableFont, and Function: SetCellBGColor. setColWidthList function This function is used to set the column width of the table file. The function invokes Function: SetColumnWidth. writeReport function Write data to Excel report file and set the display style of the report. This function invokes writeTable function and setColWidthList function. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1-25 M2000 iSStar User Guide 1 iSStar Overview Function Description Principle getColsByIdx function This function is invoked by ExecMMLCmd function and is used to get the data of some columns. This function invokes 5.2.15 Function: GetRecordNum, 5.2.20 Function: GetAttrNum, and 5.2.18 Function: GetAttrValueByIdx. FormatList function This function is used to convert List type to character string. The function invokes HSL built-in function str to implement data conversion. 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. Operational Environment Specifications Table 1-11 shows the running environment specifications needed by iSStar. Table 1-11 iSStar running environment specifications Item Configuration Requirement Hardware Configuration PCs working under the Windows operating system Software configuration l Server: Solaris8 or Solaris10 l Client: Microsoft Windows 2000 Professional Service Pack 4 or higher versions and Microsoft Windows XP Professional Service Pack 1 or higher versions Performance Counters Table 1-12 shows the performance specifications of iSStar. Table 1-12 Performance specifications of iSStar 1-26 Item Range Number of local tasks simultaneously started in a GUI <=50 Number of debugging tasks included <=1 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 1 iSStar Overview Item Range Number of timed tasks simultaneously started on M2000 Server <=500 Number of script files simultaneously opened on the GUI <=100 Size of a single script file <=1 MB Number of workstations that can be created <=10 Number of bookmarks that can be created in a workstation <=70 Number of lines of a script file <=99999 Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1-27 M2000 iSStar User Guide 2 iSStar Management 2 iSStar Management About This Chapter This describes the iSStar file system, log information, process service information, and rights required for iSStar operations. 2.1 iSStar File System This describes the file system of the iSStar client. The file system stores the file information that is read and exported during the iSStar execution. 2.2 iSStar Log Data The iSStar log records all the operations and the iSStar running states for you to locate problems. 2.3 iSStar Process and Service When the M2000 runs well, the server starts the scriptserver_agent process related to the iSStar. The scriptserver_agent process provides ScriptServer service. The functions of the iSStar are available only when scriptserver_agent runs well. You can view the service state of the M2000 system to know the running state of the process. 2.4 iSStar User Authority Setting Because the iSStar is an enhanced component of the M2000, the iSStar is under the license control and security management of the M2000. To use the functions provided by the iSStar, you need to set rights for the iSStar users on the M2000. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 2-1 M2000 iSStar User Guide 2 iSStar Management 2.1 iSStar File System This describes the file system of the iSStar client. The file system stores the file information that is read and exported during the iSStar execution. The iSStar client installation package is integrated in the M2000 client installation package. The iSStar client is installed together with the M2000 client. You can select whether to install the iSStar during the M2000 installation. If you choose to install the iSStar when installing the M2000, two iSStar of the online and offline versions are installed in the system. The differences are as follows: l l l The functions are different. – The online iSStar provides all the functions of iSStar, including creating script application, interacting with NEs, and sending MML commands. – The offline iSStar is not capable of creating script application, interacting with NEs, and sending MML commands. The start modes are different. – The online iSStar is integrated in the M2000 client software. You need to start the M2000 client software, and then select Maintenance > iSStar > Development Platform from the M2000 client interface. – For the offline iSStar, you need to choose Start Menu > iManager M2000 Client > iSStar tool(offline) or run <M2000 client installation directory>\client_offline \Run_iScript.bat to start. Dependences on the M2000 client are different. – You need to log in to the M2000 client to use the online iSStar. – You need not log in to the M2000 to use the offline iSStar. Table 2-1 shows the directory structure related to the iSStar. Table 2-1 Directory structure of the iSStar client 2-2 Directory Description M2000 client installation directory Installation directory of the M2000 client software, C:\iManagerM2000Client by default. M2000 client installation directory\client Directory for storing executable files. The related files of the iSStar script descriptor, such as python24.dll is saved in the directory. M2000 client installation directory\client \bin Storage directory for starting the M2000 client program. M2000 client installation directory\client \help Storage directory for online help. M2000 client installation directory \client_offline Directory for storing offline iSStar version. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 2 iSStar Management Directory Description M2000 client installation directory\script \samples Directory for storing script examples. M2000 client installation directory\script \Projects Default directory for storing script projects. M2000 client installation directory\script \config Directory for storing configuration files. M2000 client installation directory\script \output Default directory for storing output information during the iSStar execution. M2000 client installation directory\client \tracefile Directory for storing trace files. Some information generated during iSStar execution is stored in this directory. 2.2 iSStar Log Data The iSStar log records all the operations and the iSStar running states for you to locate problems. Because the iSStar is an enhanced component of the M2000, the M2000 manages the iSStar logs and monitors the iSStar uniformly. iSStar log data is classified into two types: l Operation logs: All the operations during the use of the iSStar are recorded in the operation log of the M2000 network management system. You can view the operation log of the M2000 network management to know your operations and other people's operations. For details about viewing the operation log, see M2000 Operator Guide. l trace file: The running information of the M2000 system, including the iSStar, is stored in M2000 client installation directory\client\tracefile. You can view this file to know the running state of the iSStar. 2.3 iSStar Process and Service When the M2000 runs well, the server starts the scriptserver_agent process related to the iSStar. The scriptserver_agent process provides ScriptServer service. The functions of the iSStar are available only when scriptserver_agent runs well. You can view the service state of the M2000 system to know the running state of the process. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 2-3 M2000 iSStar User Guide 2 iSStar Management Controlling the scriptserver_agent process You can know the running state of the scriptserver_agent process through one of the following methods: l l 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. Go to the installation directory of the M2000. The default installation directory is / opt/OMC. -bash-3.00$ cd /opt/OMC 2. Run the following command: -bash-3.00$ . ./svc_profile.sh -bash-3.00$ svc_adm -cmd status Host: DEFAULTSYSAGENT Service Agent: 3gpp_agent [1 service(s)] pid: 24278 3GPPAgent [running ] Service Agent: 3rdTool_agent [1 service(s)] pid: 24284 3rdToolService [running ] Service Agent: am_agent [1 service(s)] pid: 24280 AMServer [running ] Service Agent: chr_agent [1 service(s)] pid: 24286 CHRService [running ] Service Agent: cmdc_agent [1 service(s)] pid: 3113 CmDcService [running ] Service Agent: cmserver_agent [1 service(s)] pid: 24282 CMServer [running ] Service Agent: devdoc_agent [1 service(s)] pid: 24290 DevDocService [running ] Service Agent: em_agent [1 service(s)] pid: 24292 EventService [running ] Service Agent: fmexport_agent [1 service(s)] pid: 24296 FaultExportService [running ] Service Agent: fmnotify_agent [1 service(s)] pid: 24294 FMNotify [running ] Service Agent: ifms_agent [1 service(s)] pid: 24304 FaultService [running ] Service Agent: irp_agent [1 service(s)] pid: 24307 IRPService [running ] Service Agent: itmserver_agent [1 service(s)] pid: 24309 ITMServer [running ] Service Agent: log_agent [1 service(s)] pid: 24329 LogService [running 2-4 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. ] Issue 01 (2008–12–08) M2000 iSStar User Guide 2 iSStar Management Service Agent: maintain_agent [1 service(s)] pid: 24355 MaintenanceService [running ] Service Agent: manager_agent [1 service(s)] pid: 24556 SystemService [running ] Service Agent: mml_agent [1 service(s)] pid: 24339 MMLAgent [running ] Service Agent: mmlproxyserver_agent [1 service(s)] pid: 1334 MMLProxyServer [running ] Service Agent: monitor_agent [1 service(s)] pid: 24367 MonitorService [running ] Service Agent: neuser_agent [1 service(s)] pid: 24400 NeUserService [running ] Service Agent: nimserver_agent [1 service(s)] pid: 3485 NIMServer [running ] Service Agent: nms_mml_agent [1 service(s)] pid: 24392 NMSMMLServer [running ] Service Agent: notify_agent [1 service(s)] pid: 25379 RemoteNotifyService [running ] Service Agent: objgrp_agent [1 service(s)] pid: 24407 ObjGrpService [running ] Service Agent: omcne_agent [1 service(s)] pid: 24403 OMCNEService [running ] Service Agent: partition_agent [1 service(s)] pid: 24444 PartitionService [running ] Service Agent: pm_agent [1 service(s)] pid: 24432 PMService [running ] Service Agent: pmexp_agent [1 service(s)] pid: 24424 PMExport [running ] Service Agent: pmmon_agent [1 service(s)] pid: 24427 PMMonService [running ] Service Agent: proxy_agent [1 service(s)] pid: 24447 ProxyServer [running ] Service Agent: sac_agent [1 service(s)] pid: 24314 LicenseService [running ] Service Agent: scriptserver_agent [1 service(s)] pid: 24468 ScriptServer [running ] Service Agent: sm_agent [1 service(s)] pid: 24491 SecurityService [running ] Service Agent: snmp_agent [1 service(s)] pid: 24513 SnmpAgent [running ] Service Agent: sumdata_agent [1 service(s)] pid: 6456 SumDataService [running ] Service Agent: sumreport_agent [1 service(s)] pid: 24544 SumReportService [running ] Service Agent: swm_agent [1 service(s)] pid: 24450 SWMService [running Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. ] 2-5 M2000 iSStar User Guide 2 iSStar Management Service Agent: threshold_agent [1 service(s)] pid: 24571 ThresholdService [running ] Service Agent: tm_agent [1 service(s)] pid: 24627 TopoService [running ] [All Services: 39 ] [Running: 39 ] [No License: 0 ] [Not Running: 0 ] If the system displays the following information, it indicates that the scriptserver_agent process runs normally. Otherwise the process is not normal. Service Agent: scriptserver_agent [1 service(s)] pid: 24468 CmeServer [running ] If the scriptserver_agent process does not run normally, you can start scriptserver_agent through the following method: 1. Go to the installation directory of the M2000. The default installation directory is /opt/ OMC. -bash-3.00$ cd /opt/OMC 2. Run the following command: # . ./svc_profile.sh # svc_adm -cmd start ScriptServer 2.4 iSStar User Authority Setting Because the iSStar is an enhanced component of the M2000, the iSStar is under the license control and security management of the M2000. To use the functions provided by the iSStar, you need to set rights for the iSStar users on the M2000. iSStar User Right List Table 2-2 shows the rights for iSStar operations. 2-6 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 2 iSStar Management Table 2-2 iSStar User Right List Authority Description Type Local operations After owning this right, you can perform the following operations: Network management application authority Timing task operations l Running scripts l Debugging scripts l Running a Script Project l Debugging a Script Project l Running script project packages l Packing script projects l Create script applications. l Running a Script Application l releasing script applications After owning this right, you can perform the following operations: Network management application authority Creating Scheduled Tasks Setting iSStar User Rights To set the iSStar user rights, perform the following operations: 1. Choose Security > Security Management. 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. On the Operation Rights tab page, click Add. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 2-7 M2000 iSStar User Guide 3 iSStar Operation 3 iSStar Operation About This Chapter This describes the operation procedure of the iSStar and how to use the iSStar to develop, manage, or use scripts. 3.1 iSStar Operation Procedure The iSStar operation procedure consists of script development procedure and script application procedure. Understanding and complying with these procedures can improve the efficiencies of script development and service deployment. 3.2 Developing Scripts Script development is a process for developing scripts on the iSStar development platform by using the HSL and HFC library functions. The development involves creating new script files, testing script files, creating script projects, and packing scripts into script applications. 3.3 Using Scripts The iSStar provides script files, script projects, and script applications to implement multiple service functions, to meet different usage requirements, and to facilitate service deployment. 3.4 Managing Scripts This describes how to view the script application information, release and download script application, delete unnecessary script application, and manage script application bookmark through the iSStar. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-1 M2000 iSStar User Guide 3 iSStar Operation 3.1 iSStar Operation Procedure The iSStar operation procedure consists of script development procedure and script application procedure. Understanding and complying with these procedures can improve the efficiencies of script development and service deployment. Script Development Procedure As a script developer, you should comply with the specified development procedure when developing scripts. In this way, your development efficiency is greatly improved. Figure 3-1 shows the recommended script development procedure. Figure 3-1 Progress for developing scripts The progress is as follows: 1. 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. Run the script development platform Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is displayed. You can manage scripts on iSStar Main Window. 3. Create and edit script files You can edit script files by using the HSL, for example, copy, cut, paste, find, replace, print, undo, redo, locate line number, and set shortcuts. 3-2 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation 4. Debug script files For created script files, you can debug and verify the functions. Script Application Procedure As a script application personnel, you should focus on the services provided by scripts instead of the service implementation details. You can use the scripts through the following methods: l 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. l 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. l Script applications If the services are packed into a script project package, see Figure 3-2 for the operation procedure. Figure 3-2 Script Application Operation Flow Chart The progress is as follows: 1. Obtain the script application package. Multiple methods can be used for obtaining the project package, for example: 2. Issue 01 (2008–12–08) l Packing the existing script projects into a script project package. l Downloading the data from the server. For details, see 3.4.2 Downloading a Script Application to the Local Terminal. Create script applications. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-3 M2000 iSStar User Guide 3 iSStar Operation On the iSStar Application Management window, create a script application bookmark. For details, see 3.2.5 Creating a Script Application. 3. Running a Script Application On the iSStar Application Management window, run the application programs. For details, see 3.3.4 Running a Script Application. NOTE 4. l For some applications, you need to select the NEs before running the applications. l You can view the script task states and terminate script tasks on the iSStar Task Manage Window. For details, see Viewing the Script Task States and Stopping a Script Task. View the result You can view the results on iSStar Execute Window. 3.2 Developing Scripts Script development is a process for developing scripts on the iSStar development platform by using the HSL and HFC library functions. The development involves creating new script files, testing script files, creating script projects, and packing scripts into script applications. 3.2.1 Creating a Script File A script file is the carrier for service functions. You can create script files and compile scripts to provide specific service functions. 3.2.2 Debugging a Script File The iSStar provides powerful script debugging function and supports step over, step into, step out, and set breakpoints. In this way, you can uquickly locate the faults in the script to greatly improve the script development efficiency and ensure the correctness of the script. 3.2.3 Creating a Script Project If a task involves multiple scripts. you can organize multiple script files into a project. You can create a script project and add scripts to the new project to manage multiple scripts. 3.2.4 Debugging a Script Project You can debug a script project to find errors of the scripts. 3.2.5 Creating a Script Application An application is an aggregation of scripts that meet the requirements of specific services. Through the application, you need to concern only with the operation results rather than the implementation details. The iSStar can create applications and use bookmarks as an entry to the applications. Script applications are categorized into local script applications and remote script applications. 3.2.1 Creating a Script File A script file is the carrier for service functions. You can create script files and compile scripts to provide specific service functions. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 l Click l Press Ctrl+X. l Right-click the text to be cut, and then choose Cut. in the iSStar Main Window. Select the text to be copied and copy the selected text in one of the following three ways: l Click in the iSStar Main Window. l Press Ctrl+C. l Right-click the text to be copied, and then choose Copy. Position the cursor at the place where you plan to paste. Paste the text in one of the following three ways: l Click in the iSStar Main Window. l Press Ctrl+V. l Right-click and choose Paste. NOTE l You can perform the pasting operation only in the script editing area of iSStar Main Window. l If the pasted text exceeds 1 MB, the system displays the following message: After you insert the text, the size of the file exceeding 1 MB. Thus, text inserting fails. l If the pasted text exceeds 99999 lines, the system displays the following message: After you insert the text, the file contains more than 99999 lines. Thus, text inserting fails. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 Right-click the script editing area, and then choose Find. 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 of the Find dialog box. Replace Replace character strings. You can choose either of the following two methods: l Right-click the script editing area, and then choose Replace. l Press Ctrl+R. NOTE l Cyclic replace all is supported. l 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 of the Replace dialog box. Undo Undo a previous operation in one of the following two ways: l Right-click the script editing area, and then choose Undo. l Press Ctrl+Z. NOTE Only the last 100 operations can be undone. Redo Redo the undo operation in one of the following two ways: l Right-click the script editing area, and then choose Redo. l Press Ctrl+Y. NOTE The number of redo operations is equal to that of undo operations. 3-6 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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. l Press Ctrl+G. NOTE The number that you can enter is from 1 to 99999. Add/Remove Bookmark You can use a bookmark to implement the skipping inside a file; thus facilitating your positioning of the script file. You can choose either of the following two methods: l Right-click the gray area on the left part of the script editing area, and then choose Add/Remove Bookmark. l Press Ctrl+F2. NOTE l If the current line is not marked, a bookmark is added. 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 l If it is the first save, the Save As is displayed. Specify the path and file name and click Save. l To save a script file in other name or to other path, click of the script editing area, and then choose Save As. . Alternatively, right-click the tab bar ----End Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-7 M2000 iSStar User Guide 3 iSStar Operation 3.2.2 Debugging a Script File The iSStar provides powerful script debugging function and supports step over, step into, step out, and set breakpoints. In this way, you can uquickly locate the faults in the script to greatly improve the script development efficiency and ensure the correctness of the script. Prerequisite l You are authorized to operate scripts. l A script file is already compiled. l There is no debugging task. Context When you start to debug a script, the system creates a debugging task for the script. CAUTION If a debugging task already exists, you cannot create a new debugging task. Only after the existing debugging task is deleted, a new debugging task can be created. Procedure Step 1 Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is displayed. Step 2 Click . Alternatively, right-click the tab bar in the edit area, and then choose Open. Step 3 In the Open dialog box, select the script file to be debugged, and then click Open. Step 4 Click . Alternatively, right-click the script editing area, and then choose Debug. NOTE You can right-click the script editing area and choose Check to check grammatical errors in the script and to debug after grammatical errors are removed. Step 5 In the iSStar Debug Window, you can perform the following operations as required. If... Then... Stop Click . Alternatively, press Shift+F5. NOTE After the debugging is complete, the greyed out. 3-8 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. button is Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation If... Then... Step Over Click . Alternatively, press F11. NOTE l If the next step calls functions or script files, the finally points to the first indicating pointer line of the external function after the internal function is executed. l The button becomes gray if the command is being executed and no execution result is provided. Step Into Click . Alternatively, press F12. NOTE l If the next step calls functions or script files, the finally points to the first indicating pointer line of the external function after the internal function is executed. l The button becomes gray if the command is being executed and no execution result is provided. Step Out Click . Alternatively, press Ctrl+F12. NOTE l If the system is executing the internal function, the pointer skips to the next line of the external function. l If you are debugging at the outmost layer of the script file, perform step out and run to the next breakpoint. If there is no breakpoint in the forthcoming lines, proceed untill the end of the file. Continue Click . Alternatively, press F5. NOTE l If you set breakpoints in the script files that are indicator jumps from the debugged, the existing position to the breakpoint position. l If the script file calls functions or other scripts with breakpoints, then the pointer skips to the breakpoint from the beginning of the function or script. A breakpoint is a point indicating the interruption of a running task. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-9 M2000 iSStar User Guide 3 iSStar Operation If... Then... You want to add/remove breakpoints, You can choose any of the following methods: l Click . l Press F9. l Right-click the left gray area of the iSStar Debug Window window or iSStar Main Window window, and then choose Add/ Remove Breakpoint . For details about the iSStar Debug Window, refer to 1.5.1 Script File Development. For details about the iSStar Main Window, refer to 1.5.1 Script File Development. NOTE You can set a maximum of 32 breakpoints for one file. The breakpoints are not saved after the file is closed. You want to clear all breakpoints, Run to current line You can choose any of the following methods: l Click on the toolbar. l Press F9. l Right-click the left gray area of the iSStar Debug Window window or iSStar Main Window window, and then choose Remove All Breakpoints . For details about the iSStar Debug Window, refer to 1.5.1 Script File Development. For details about the iSStar Main Window, refer to 1.5.1 Script File Development. Right-click a line below the indicating pointer line, and then choose Run to Current Line . Alternatively, press F4. NOTE l The indicating pointer always point to the next statement to be executed. l If a breakpoint exists before the current line, the pointer stops at the breakpoint. l If a script has been executed and not reached the current line, the state of iSStar Task Management Window is updated to Debug Finished. The information on the Watch tab page and Stack tab pages is cleared. 3-10 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation If... Then... You want to close iSStar Debug Window, Click . NOTE l After the iSStar Debug Window window is closed, the debugging task in the iSStar Task Manage Window window is deleted. l If you delete the debugging task in the iSStar Task Manage Window window, the corresponding iSStar Debug Window window is closed. Add to Watch You can choose either of the following two methods: l Right-click a variable to be watched in the iSStar Debug Window display area, and then choose Add to Watch. l Right-click the Watch tab page in the iSStar Debug Window window, and then choose Add to Watch. NOTE l A maximum of 32 watch variables can be added. l On the Watch tab page of the iSStar Debug Window window, right-click a watch variable to be deleted, and then choose Remove to delete a variable that need not be watched. You plan to activate the editing window, 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. You plan to activate task management window, 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. l The MML Response tab page contains the MML commands and displayed information during the running and debugging of the script file.。 l The Stack tab page displays the complete path information invoked by the current function. The path is refreshed as the script file is being executed. l The Watch tab page displays the change information of the variables during the debugging of the script file. Postrequisite Click during the debugging. The iSStar Main Window window is displayed. You can edit the currently debugging script file. 3.2.3 Creating a Script Project If a task involves multiple scripts. you can organize multiple script files into a project. You can create a script project and add scripts to the new project to manage multiple scripts. 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. l Project path: indicates the save path of the project file. l Main file: indicates the entry file of the project. You can set this parameter after creating a project and adding script files. l Project description: indicates the brief description of the project. l If the Running on background: is Yes, you can infer that a project is running on background. The results are not displayed on the foreground. If the Running on background: is Noindicates that a project is running on foreground. The results are displayed on the foreground. l Created by: indicates the creator of the script project. l Creation time: indicates the creation time of the script project. l File list: displays the main file information about the project when main file is set. Step 4 Click Confirm. 3-12 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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, In the navigation tree of the project management area, right-click a script project name node, and then choose Create File. The system creates a new script file and adds it to the current project. You can compile a script in the script file to implement the functions that you require. Add files to a project, 1. In the navigation tree of the project management area, right-click a script project name node, and then choose Add File to Project. 2. In the Open dialog box, select a script file that you plan to add to the project. Click Open. Set project attributes, 1. In the navigation tree of the project management area, right-click a script project name node, and then choose Project Attributes. 2. In the Project Attributes window, set the parameters on the Basic Parameter tab page and Preset Parameter tab page. Click Confirm. 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, In the navigation tree of the project management area, right-click the script file name node which you want to set as main file, and then choose Remove File from Project . NOTE To remove a file from the project is to remove a script file from the script project rather than to remove the script file itself. Delete a file, In the navigation tree of the project management area, right-click the script file name node which you want to set as main file, and then choose Remove File . NOTE Deleting a file removes a script file from the script project and deletes the script file. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-13 M2000 iSStar User Guide 3 iSStar Operation If You Plan to... Then... Pack a project, 1. In the navigation tree of the project management area, right-click a script project name node, and then choose Pack Project. Alternatively, click . 2. If the script project has not set the main file, the system displays a message, indicating that the script project does not set the main file. Thus, you cannot pack the project. Set the main file of the script project first. 3. The Confirm dialog box is displayed, prompting you about Support Decompressing. Click Yes to support the decompressing. Click No not to support the decompressing. 4. In the Pack Project dialog box, set the name and save path of the script project pack, and then click Save. 5. The system displays a message, indicating that the packing succeeds. Click OK. Close a project, In the navigation tree of the project management area, right-click a script project name node, and then choose Close Project. Delete a project, In the navigation tree of the project management area, right-click a script project name node, and then choose Delete Project. ----End 3.2.4 Debugging a Script Project You can debug a script project to find errors of the scripts. Prerequisite l You are authorized to operate scripts. l A script project file is already compiled. l There is no debugging task. Context When you plan to debug a script project, the system creates a debugging task for the script project. 3-14 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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. l The MML Response tab page contains the MML commands and displayed information during the running and debugging of the script file. l The Stack tab page displays the complete path information invoked by the current function. The path is refreshed as the script file is being executed. l The Watch tab page displays the change information of the variables during the debugging of the script file. Postrequisite during the debugging. The iSStar Main Window window is displayed. You can edit Click the currently debugging script file. 3.2.5 Creating a Script Application An application is an aggregation of scripts that meet the requirements of specific services. Through the application, you need to concern only with the operation results rather than the implementation details. The iSStar can create applications and use bookmarks as an entry to the applications. Script applications are categorized into local script applications and remote script applications. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-15 M2000 iSStar User Guide 3 iSStar Operation Prerequisite l The connection between the M2000 and the server is normal. l The script project files are ready. l The script project files of the local script applications are saved and executed on the local PC. The script project files of the remote script applications are saved and executed on the server. Remote applications can be shared among different clients. l You can organize different script applications into different workspaces as required. l You can create a maximum of 10 workspaces. l In each workspace, you can create a maximum of 70 bookmarks. l The extension of a script application file is .hsp. 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 Click the target workspace to use the existing workspace. 1. Click . The Workspace window is displayed. 2. Enter a value in the Workspace Name, and then click OK. Step 3 Click . Alternatively, right-click the blank area of Workspace, and then choose Add Bookmark. The Add Bookmark window is displayed. Step 4 Set the corresponding parameters in the Add Bookmark window. Select the Application Type. Enter the Bookmark Name. Then, click Icon File. , and then select Step 5 Perform different operations based on Application Type. 3-16 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation Application Type Procedure Local application 1. Click of the Source File. The Open window is displayed. 2. Select a project file, and then click Open. Remote application 1. Click of the Source File. 2. In the Remote File Summary window, select a project file, and then click OK. Step 6 Click OK. ----End 3.3 Using Scripts The iSStar provides script files, script projects, and script applications to implement multiple service functions, to meet different usage requirements, and to facilitate service deployment. 3.3.1 Types and Status of Script Tasks Script tasks can be classified into immediate tasks and scheduled tasks based on the execution time. Tasks can be classified into local tasks and remote tasks by location. A task has multiple states. Immediate tasks and scheduled tasks have different states. 3.3.2 Running a Script File The iSStar provides the script running function. By running script files, you can perform the maintenance using the service function provided by the script. 3.3.3 Running a Script Project By running a script project, you can use the service functions provided by all the scripts of the script project. 3.3.4 Running a Script Application After creating a script application, you can run the script application to finish specific service function. 3.3.5 Viewing the Result of a Script When running a script, you can view the output information of the script execution. 3.3.6 Monitoring the Process of Running a Script This describes how to control the execution of scripts through the iSStar. The operations include viewing the state of script tasks, viewing the output files of script tasks, pausing, resuming, and terminating script tasks, and deleting unnecessary script tasks. 3.3.1 Types and Status of Script Tasks Script tasks can be classified into immediate tasks and scheduled tasks based on the execution time. Tasks can be classified into local tasks and remote tasks by location. A task has multiple states. Immediate tasks and scheduled tasks have different states. Classification of Script Tasks There are two ways to classify script tasks. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-17 M2000 iSStar User Guide 3 iSStar Operation l 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 Scheduled tasks are saved and operated on the server. States of an Immediate Task An immediate task has eight states. Running tasks and debugging tasks have different states. A running task has the following states: suspended, running, finished, pausing, paused, and terminated exceptionally. For details, see Figure 3-3. Table 3-1 describes Figure 3-3. Figure 3-3 State transition of a running task 3-18 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation Table 3-1 State transition of a running task State 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 The task is running. After a waiting task is started, it is in the running state. Finished The task has finished running. After a script file finishes running, it is in the finished state. Terminated exceptionally If exceptions occur or the task is stopped during the running, the state of the task is terminated exceptionally. Pausing The system is pausing the task. The task is transiting from the running state to the paused state. Paused The task is 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 Table 3-2 State transition of a debugging task State Description Suspended The task is not ready to be scheduled. After an immediate task is created or copied, it is in the suspended state. Debugging The task is being debugged. After a waiting task is being debugged, it is in the debugging state. Debug finished Indicates that the script execution is complete and the debugging ends. After a script file finishes debugging, it is in the debug finished state. Terminated exceptionally If exceptions occur or the task is stopped during the debugging, the state of the task is terminated exceptionally. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-19 M2000 iSStar User Guide 3 iSStar Operation States of a Scheduled Task Timed tasks are classified into idle, running, suspended, and finished states by the execution state of the tasks. The states of a scheduled task change with different operations. Table 3-3 describes Figure 3-3. Figure 3-5 State transition of a scheduled task Table 3-3 States of a scheduled task State Description Idle A scheduled task is in the idle state after it is initially created. Running After being dispatched, an idle task changes to the running state. If a running task is canceled, its state changes to idle. Finished A task is in the complete state if it does not require to be dispatched. It requires to be dispatched, its state changes to idle. Suspended You can suspend an idle scheduled task. Then, the task is in the suspended state. The suspended task changes to the idle state if you resume it. 3.3.2 Running a Script File The iSStar provides the script running function. By running script files, you can perform the maintenance using the service function provided by the script. 3-20 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation Prerequisite l You are authorized to operate scripts. l A script file is already compiled. l To run a script file is a procedure that the iSStar descriptor parses and executes the content of the script file to provide specific service functions. l Each time you run a script file, the system creates a corresponding script task. 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 . Alternatively, right-click in the edit area, and then choose Run. NOTE l You can run the script of an iSStar script file without opening it. To run a script without opening a script file, you can click a script file. l , 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. , and then select Range Step 5 In the iSStar Execute Window, you can perform the following operations as required. If You Plan to... Then... Stop executing the script, Click . NOTE Only the running script can be stopped. In other situations, appears dimmed. Re-execute the script, Click . NOTE Only a script that has finished running can be re-executed. In other situations, Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. appears dimmed. 3-21 M2000 iSStar User Guide 3 iSStar Operation If You Plan to... Then... Pause executing the script, Click . NOTE Only the running script can be paused. In other situations, appears dimmed. View the output directory, Click , you can locate the directory of the system's output files. NOTE After a script finishes running, you can view the output directory. In other situations, Close iSStar Execute Window, Click appears dimmed. . NOTE l After you close iSStar Execute Window, the corresponding tasks on the iSStar Task Manage Window window are deleted. l If you delete a script file in iSStar Task Manage Window, the iSStar Execute Window corresponding to the script is closed. Activate the editing window, Click . The iSStar Main Window window is displayed. Activate task management window, Click . The iSStar Task Manage Window window is displayed. You can view the script task of the corresponding script. ----End 3.3.3 Running a Script Project By running a script project, you can use the service functions provided by all the scripts of the script project. Prerequisite 3-22 l You are authorized to operate scripts. l A script project is already compiled. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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. l The system creates a task for each running script project. l If a script project is set to background running, during running of the project, you do not access iSStar Execute Window. Otherwise, you access iSStar Execute Window. For operations in the window, see 3.3.2 Running a Script File. l To run a script project, perform the following operations. Procedure 1. Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is displayed. 2. . Alternatively, right-click the project management area, and then choose Click Open Project . 3. In the Open dialog box, select the script project file or project package file to be opened, and then click Open. The file of which the File Type is *.dsl is a script project file. *.hsp is a script project package file. CAUTION If the script project package does not support the decompression operation, the system displays Decompressing the project package is not supported. Click . Choose Select Task and Run to run the script project package that cannot be decompressed. 4. In the navigation tree of the project management area, right-click the node of project name, and then choose Run Project from the shortcut menu. Alternatively, click . l To run a script file of the already opened project, perform one of the following operations: – In the navigation tree of the project management area, right-click the script file name node of the project, and then choose Run Single File. – In the navigation tree of the project management area, double-click the script file name node of the project to be executed, or right-click the node, and then choose Open . Then, click . ----End 3.3.4 Running a Script Application After creating a script application, you can run the script application to finish specific service function. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-23 M2000 iSStar User Guide 3 iSStar Operation Prerequisite l The connection between the M2000 and the server is normal. l A script application is already created. Procedure Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application Management window is displayed. Step 2 Click the workstation where the script file to be executed is located. Step 3 Perform different operations according to whether the application requires to select the NEs. 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 check box indicates that the NE is disconnected. supports only one NE. supports multiple NEs and batch creation of local script tasks. Each task corresponds to a specific NE. 2. Select an NE and click Confirm. 3. Go to Step 4. Step 4 Run a script application Running Mode Procedure Execute immediately You can use one of the following methods to run an application: 3-24 l Click . l Double-click the script application bookmark. l Right-click the script application bookmark and choose Run. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 Task Name: indicates the name of a scheduled task. l Task Type: Set it to Script Executor. l Run Type: Set it to Once or Period. 3. Click Next to set the time for the execution of a task. 4. Click . In the displayed Date/Time Selection dialog box, set the start time. 5. If the execution type is once, click Next. Otherwise, enter values in Period and Run Times, and then click Next. 6. Set the Accessory File and NEs to be operated as required. 7. Click Finish. ----End Postrequisite The iSStar creates a script task for the running script application. In case of immediate tasks, you can view the states of the script tasks and terminate the script tasks in iSStar Task Manage Window. For details, see Viewing the Script Task States and Stopping a Script Task. In case of scheduled tasks, you can manage the tasks in Task Management. 3.3.5 Viewing the Result of a Script When running a script, you can view the output information of the script execution. Prerequisite The script is running. Procedure Step 1 After the script is executed, the system automatically goes into the iSStar Execute Window. For running a script file, see 3.3.2 Running a Script File. Step 2 View the output information between different interfaces of the system Area Description Print output area Displays the output information of the print function during the execution of a script Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-25 M2000 iSStar User Guide 3 iSStar Operation Area Description MML message output area Displays the MML command and return information during the execution of a script. MML command statistic bar Displays the number of commands sent, the number of commands successfully executed, and the number of failed commands. Step 3 Views the output information. You can execute the following operations on the output information as required. Operation Procedure Copy 1. Copies the text you need in the print output area or MML message output area. 2. Right-click the text you select, and then choose Copy . Alternatively, you can use the shortcut keys Ctrl+C. Clear Right-click the print output area or MML message output area and select Clear. Find Right-click the print output area or MML message output area, and then choose Find. Alternatively, you can the shortcut keys Ctrl+F. NOTE l Cyclic find all is supported. l You 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.3.6 Monitoring the Process of Running a Script This describes how to control the execution of scripts through the iSStar. The operations include viewing the state of script tasks, viewing the output files of script tasks, pausing, resuming, and terminating script tasks, and deleting unnecessary script tasks. 3-26 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation Viewing the Script Task States This describes how to view the task status to familiarize yourself with the information about the operating tasks and the debugging tasks. The information consists of the main files of tasks, task types, selected NEs, and the status, progress, start time, and end time. Prerequisite A running or debugging task exists. Context Running tasks and debugging tasks have different states. Eight task states are available. For details, see Types and States of Script Tasks. l A running task has the following states: suspended, running, finished, pausing, paused, and exceptionally terminated. l A debugging task has the following states: suspended, debugging, debug finished, and exceptionally terminated. NOTE Because only one existing debugging task is allowed on the M2000 client, the debugging and debug finished cannot co-exist. Procedure Step 1 Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is displayed. Step 2 Perform operations according to the task types. Task Type Procedure Immediate tasks 1. Click . The iSStar Task Manage Window is displayed. 2. Go to Step 3. Scheduled tasks Click to start the Task Management window. You can view the task information of the task list in the right window. Step 3 In iSStar Task Manage Window, select the Local Task or Remote Task tab according to the task type to be created. View the task state, including main file of the task, task type, selected NE, task state, progress, start time, and end time. NOTE l The Progress is described in scripts and fed back to the client. When the statement feeding back the progress is operated, the Progress exports the progress value in the scripts. If there is no statement feeding back the progress in the scripts, Progress is always displayed as 0%. l You can click to refresh the iSStar Task Manage Window. ----End Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-27 M2000 iSStar User Guide 3 iSStar Operation Viewing Output Files of a Script Task Output files save the output information during the execution of a script file. The output information includes print output information (output of the print function in the script file), and MML message output file. You can familiarize yourself with the detailed output information during the execution of a script file through viewing the output file. Prerequisite A script task is already created. Procedure l l 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. To view the remote task output, perform the following steps: 1. Choose Maintenance > Task Management. The Task Management window is displayed. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation Pausing and Resuming a Script Task This describes how to pause a running script task according to your requirements. In this way, the script task is in the paused state. You can also resume a paused task. Procedure Step 1 Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is displayed. Step 2 Click . The iSStar Task Manage Window is displayed. Step 3 In the iSStar Task Manage Window, click the Local Task or Remote Task tab based on the target task type. NOTE The files of local tasks are saved and executed on the local PC. The files of remote tasks are saved and executed on the server. Step 4 Right-click a script task to be operated, and then choose Pause or Resume. After you pause a running script task, the script task transfers its state from the pausing state to the paused state. After you resume a paused task, the task transfers its state from the pausing state to the running state. For details, see States of an Immediate Task. ----End Stopping a Script Task You can stop a local script task or remote script task that is running or being debugged. 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 . The iSStar Task Manage Window is displayed. Step 3 In the iSStar Task Manage Window, click the Local Task or Remote Task tab based on the target task type. NOTE The files of local tasks are saved and executed on the local PC. The files of remote tasks are saved and executed on the server. Step 4 Right-click the target task, and then choose Stop from the shortcut menu. After this operation, the system stops the running or debugging task. The task state changes toTerminated Exceptionally. ----End Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-29 M2000 iSStar User Guide 3 iSStar Operation Result After a task is stopped, you cannot restart or resume the task. Deleting a Script Task This describes how to delete a task that is not required. In this way, you can save system resources. The script file or script project corresponding to the script task is not deleted. Prerequisite If you need to delete a remote task, ensure that the connection between the client and the M2000 is normal. Context l You can delete the local script task that you create on the client and the remote script task that you create. l Deleting a script task does not involve the deletion of the script of the script task and of the script project. l You can delete a task in any state. Procedure Step 1 Choose Maintenance > iSStar > Development Platform . The iSStar Main Window is displayed. Step 2 Click . The iSStar Task Manage Window is displayed. Step 3 In the iSStar Task Manage Window, click the Local Task or Remote Task tab based on the target task type. NOTE The files of local tasks are saved and executed on the local PC. The files of remote tasks are saved and executed on the server. Step 4 Right-click a script task to be 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 3.4 Managing Scripts This describes how to view the script application information, release and download script application, delete unnecessary script application, and manage script application bookmark through the iSStar. 3.4.1 Viewing the Script Application Information 3-30 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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. 3.4.1 Viewing the Script Application Information 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. Prerequisite l If you need to view local script applications, ensure that the bookmark of the script application is created on the client. l If you need to check remote script applications, ensure that the connection between the client and the M2000 server is normal. l To view the information about the local script application, perform the following steps: Procedure 1. Choose Maintenance > iSStar > Application Management. The iSStar Application Management window is displayed. 2. Click the target workstation to use the existing workstation. 3. Right-click the bookmark of a local script application, and then choose Bookmark Properties. The Bookmark Properties window is displayed. You can view or modify the bookmark properties. 4. l Issue 01 (2008–12–08) Click OK to save the modification and close the window. To view the information about the remote script application, perform the following steps: 1. Choose Maintenance > iSStar > Application Management. The iSStar Application Management window is displayed. 2. You can perform the following operations according to the existence of the corresponding bookmark of the script application. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-31 M2000 iSStar User Guide 3 iSStar Operation If... Then... The corresponding shortcuts exist. 1. Click the target workstation to use the existing workstation. 2. Right-click the bookmark of a remote script application, and then choose Bookmark Properties. The Bookmark Properties window is displayed. You can view or modify the bookmark properties. 3. Click OK to save the modification and close the window. The corresponding shortcuts do not exist. 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 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. Prerequisite l The connection between the M2000 and the server is normal. l The corresponding applications exist on the server. Procedure Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application Management window is displayed. Step 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 3 iSStar Operation If... Then... The bookmark corresponding to the remote script application exists, 1. Right-click the bookmark of the remote script application, and then choose Download File from the shortcut menu. Alternatively, right-click the bookmark of the remote script application. Then, click . The Open window is displayed. 2. Set the file name and save path in the Open window, and then click Open. The remote script application does not have a bookmark, 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 applications of the server. The script applications include those created by the local client (bookmarks that you can view on the local client), and those that are created by other clients. l By using this method, you can download the created remote script applications to the local terminal. ----End 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. Prerequisite l The connection between the M2000 and the server is normal. l Script applications already exist. Procedure Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application Management window is displayed. Step 2 Click . Alternatively, right-click the blank area of the workspace, and then choose Issue File from the shortcut menu. The Open window is displayed. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. Step 3 Select a file to be uploaded, and then click Open. You can click Summary. to check whether the file is uploaded to the server in Remote File ----End 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. Prerequisite If you need to delete a remote application, ensure that the connection between the client and the M2000 is normal. Context l The local script applications are saved and executed on the local PC. l The remote script applications are saved and executed on the server. l You can delete the script applications on the server issued by yourself or by other users. l The corresponding bookmarks are still available after the local or remote applications are deleted. CAUTION If a script application on the server is deleted, all the bookmarks created on the basis of this script application by users on the clients are unavailable. Procedure Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application Management window is displayed. Step 2 You can delete a remote script application by using the remote file management function or using the remote application bookmark. 3-34 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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. Remote application bookmark 1. Click the target workspace. 2. Right-click a remote application bookmark, and then choose Remove Remote File from the shortcut menu. The Confirm dialog box is displayed. 3. Click Yes. 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 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. Context Deleting a bookmark does not involve the deletion of the script application of the bookmark but only the deletion of the icon of the bookmark on the script application platform. Procedure Step 1 Choose Maintenance > iSStar > Application Management. The iSStar Application Management window is displayed. Step 2 You can create, modify, or delete bookmarks. l For details about how to create a bookmark, refer to 3.2.5 Creating a Script Application. l Modify the properties of a bookmark. . Alternatively, right-click a bookmark, and then choose After you click a bookmark, click Bookmark Properties . You can modify the properties of a bookmark in the Bookmark Properties window. l Delete a bookmark. Right-click a bookmark, and then choose Delete Bookmark. In the displayed Confirm prompt box, click Yes. ----End Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3-35 M2000 iSStar User Guide 4 HSL Reference 4 HSL Reference About This Chapter The High Level Script Language (HSL) is a simple but powerful script language provided by the iSStar. HSL reference contains the HSL syntax, data types and methods supported by HSL. 4.1 HSL Syntax The syntax of HSL contains identifiers, keywords, statements, operators, and so on. To use the HSL to write scripts better, you must understand the HSL syntax. 4.2 Data Types and Methods in the HSL This section describes basic data types and their methods in the HSL. It helps you to use the HSL for development. The data types supported by the HSL are as follows: numeric, string, list, tuple, dictionary, and file. 4.3 HSL Built-In Function This section describes the HSL built-in function that provides a group of object-specific operation functions. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-1 M2000 iSStar User Guide 4 HSL Reference 4.1 HSL Syntax The syntax of HSL contains identifiers, keywords, statements, operators, and so on. To use the HSL to write scripts better, you must understand the HSL syntax. 4.1.1 Identifier An identifier is a string. It is a name that is used to identify a variable or a function in a program. 4.1.2 Keywords A keyword is also called a reserved word. It is an identifier pre-defined in HSL. 4.1.3 Statement As basic units of script programs, statements can be classified into simple statements, MML statements, and compound statements. 4.1.4 Operator Operators are divided into basic operators, bit operators, comparative operators, Boolean operators, sequence operators, and dictionary operators. 4.1.5 String Format This section describes the string formats in HSL. You can view the information and perform operations. 4.1.6 Comment A comment gives the information on a program. It is not processed by the interpreter. HSL supports line comment and block comment in a script. 4.1.7 Condition A condition is used to express the process for selecting the program branches. 4.1.8 Loop A loop statement is used to express the repeated process for a program. The HSL supports two types of loop statements: for statement and while statement. 4.1.9 Function A function is the basic multiplex unit provided by the language. 4.1.1 Identifier An identifier is a string. It is a name that is used to identify a variable or a function in a program. The rules for naming an identifier are as follows: 4-2 l Naming rule: An identifier can contain letters (a-z, A-Z), numbers (0-9), and underlines (_). Number cannot be the leading character. l The length of an identifier is not restricted. l An identifier is case sensitive. For example, FOO and foo are different objects. l An identifier cannot be any keyword of HSL. For the keywords of HSL, see 4.1.2 Keywords. l An identifier cannot contain special characters such as $, %, or @. l When using an identifier, observe the principle of defining (assigning) first. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Available scope: For an identifier defined in a compound statement, it is functional only in its attributive compound statement block. For an identifier defined in a non-compound statement, it is functional only in its attributive script. For details, see 4.1.3 Statement. l 4.1.2 Keywords A keyword is also called a reserved word. It is an identifier pre-defined in HSL. CAUTION l The keywords in HSL are unique in the script. l Keywords cannot be re-defined. Table 4-1 lists the keywords used in HSL. The keywords global, assert, pass, try, except, raise, finally, exec, class, lambda, import, del, print, from, is, and yield are reserved keywords. They are used for the future syntax expansion. 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 Print 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. l If you want to split a statement into multiple text lines, an extended line (\) must be used. l A text line can include multiple simple statements which are separated by semicolons (;). NOTE Issue 01 (2008–12–08) l An extended line character cannot be used at the end of files, because semantic mistakes are caused. l An extended line character is invalid to a comment line. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. Table 4-2 MML statements MML Statement Format Line mode @MMLCMD:MMLargs; Block mode @@@ MMLCMD:MMLargs; MMLCMD:MMLargs; MMLCMD:MMLargs; @@@ Compound Statement The compound statement has the following three types: l Conditional statement: if...elif...else...end. The format is as follows: if expr l stmt [elif expr stmt] [else stmt] end Loop statement: for...in...end. The format is as follows: for atom in list stmt end l Loop statement: while...end. The format is as follows: while expr stmt end 4.1.4 Operator Operators are divided into basic operators, bit operators, comparative operators, Boolean operators, sequence operators, and dictionary operators. For details of the operators, see Table 4-3. Table 4-3 Basic operators Type Basic 4-4 Operator x+y Description Add Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 Get magnitude (x mod y) -x Unary negation +x 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 Greater than or equal x <= y Less than or equal x or y If either x or y is True, return True. Otherwise, return False. x and y If either x or y is False, return False. Otherwise, return True. not x If x is False, return True. Otherwise, return False. s+r Sequence cascade s*n,n*s Add s for n times, where n is an integer. d[k] Use key words as indexes. 4.1.5 String Format This section describes the string formats in HSL. You can view the information and perform operations. Table 4-4 lists the detailed description of the string formats. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-5 M2000 iSStar User Guide 4 HSL Reference Table 4-4 String format Method Description d,i Decimal integer or long integer u Unsigned integer or long integer o Octal integer or long integer x Hexadecimal integer or long integer X Hexadecimal integer (upper cased) f Floating number, such as [-]m.dddddd e Floating number, for example, [-]m.dddddde ±xx E Floating number, for example, [-]m.ddddddE ±xx g,G For index smaller than -4 or higher precision, use %e or %E. Otherwise, use %f. s String or other objects. Call str() to produce a string. r and repr() The returned strings are identical. c Single character % Indicates the flag conversion 4.1.6 Comment A comment gives the information on a program. It is not processed by the interpreter. HSL supports line comment and block comment in a script. l The line comment starts with #, and it is used to comment the content contained in a line. l The block comment uses """ or ''', and it is used to comment multiple lines of texts. l The block comment is a special string. It can serve as a string. 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 [stmt]#This is a one-line comment. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference 8 equeals2 *4 9 equeals3 *3 Loop Control Statement HSL supports two types of loop control statements: continue and break. A break statement forces the processing loop to quit, ignores all the else statements, and proceeds with the line following the last line of the loop block. The continue statement forces the programming to switch to the next loop and ignores the other statements in the current block. It re-evaluates the loop expression. Example: Using break to skip the loop l for num in [1,2,3,4] if(num == 3) break end Print('I can count to ' + str(num) ) end Result I can count to 1 I can count to 2 Example: Using continue to skip the current loop l for num in [1,2,3,4] if(num == 3) continue end Print('I can count to ' + str(num) ) end Result I can count to 1 I can count to 2 I can count to 4 NOTE In a loop, an iteration range should be specified for a number. Two methods are provided in HSL, that is, while loop and value list of the range function (list also applies). l Example: Using the while loop x = 1 while(x < 5) Print(x) x = x + 1 end l Example: Using the range function to get value list for x in range(1,10) Print(str(x)) end 4.1.9 Function A function is the basic multiplex unit provided by the language. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-9 M2000 iSStar User Guide 4 HSL Reference NOTE l The HSL does not support function re-loading. A newly-defined function automatically overwrites the previous function with the duplicate name. l The function definitions do not need to designate a return value. If you do not designate a return value, a default object None is returned after the function is invoked. l The recursive invoking of a function has a maximum depth at 1,000. l The function definitions can be nested. The definition of a function is as follows: def func(arglist...) statement... end Example def showHello() Print("Hello!") end showHello() 4.2 Data Types and Methods in the HSL This section describes basic data types and their methods in the HSL. It helps you to use the HSL for development. The data types supported by the HSL are as follows: numeric, string, list, tuple, dictionary, and file. 4.2.1 Number This section describes the numeric types of the HSL and details of numeric operations. 4.2.2 Sequence The sequence objects are accessed by digital index. The sequence contains the following types: string, Unicode string, list, and tuple. 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. 4.2.4 File This section describes a file which provides basic operations for files, such as, opening, reading, and writing files. 4.2.1 Number This section describes the numeric types of the HSL and details of numeric operations. Types Table 4-6 lists numeric types and value example. 4-10 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Table 4-6 Classification Type 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 x < y, x <= y, x > y, x >= y 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 Shift x for y to the left or right x + y, x - y Plus, subtract x * y,x % y,x / y Multiple, get remainder (format), divide -x,+x, ~x Negative, positive, inverse bit sequence 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. Example of Sequence Value Type Name StringType (string) 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 l Unicode standard is designed to serve as the collection of standards for interchanging text information globally. As Unicode standard includes the information related to character set and multi-byte format of the interchanged data, it can ensure that the read information is in the correct format and language. l All the strings in HSL do not use Unicode format automatically. HSL supports a new data type, that is, Unicode string. You can create a new Unicode object by adding a prefix u to the string, which is the same as the method of using the original string. Common Operations Operation 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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] Slice. Select the elements from i to j in the indexes of seq. The default value of i is 0, and the default value of j is len(seq). If j>len(seq), replace j with len(seq). See Example 1: Calculation in slices. 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] The default values for i, j, and s is 0, len(seq), and 1 in sequence. If j is less than i, return a null string. If j is more than len(seq), replace j with len(seq). seq1 + seq2 Connect two strings (lists or tuples) seq1 * n Repeat strings, lists, or tuples, where n is an integer representing replication times. x in seq1 Determine if x is in seq1. If yes, return True. If no, return False. See Example 2: Using in and not in for the String str. x not in seq1 Determine whether x is in seq1. If x is not in seq1, the result is True. If x is in seq1, the result is False. See Example 2: Using in and not in for the String str. len(seq) Get the length of seq. See Example 3: Using len() to Get the Lengths of str, list, and tuple. min(seq) Get the minimum value of seq. See Example 4: Using min() to Get the Minimum Item in str1, list1, or tuple1. max(seq) Get the maximum value of seq. See Example 5: Using max() to Get the Maximum Item in str1, list1, or tuple1. Example 1: Calculation in slices t = 'word !' s = '0123456789' #Output the specified index. Print("s[3] = " + s[3]) Print("s[-1] = " + s[-1]) #Output the specified slice. Print("s[2:6] = " + s[2:6]) Print("s[2:8:2] = " + s[2:8:2]) #Connect strings t new = t + s Print(new) and s. #Repeat the string t three times and assign the value to t. t = t * 3 Print(t) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 ! Example 2: Using in and not in for the String str str = 'Jake,this is your book!' #Determine whether 'f' Print('f' in str) is contained in str. If yes, return True. If no, return False. #Determine whether 'f' Print('f' not in str) is contained in str. If no, return True. If yes, return False. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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. String Object Methods For details of the string object methods, see Table 4-8. Table 4-8 String object methods Method 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]) The width argument is an integer and indicates the length of the return string. The fillchar argument is a string and indicates the characters to be filled in the initial and end parts of the return string. NOTE l When the length of width is not greater than that of the original string, s is returned and no padding is done. l When the length of width is greater than that of the original string, fill in fillchar in turn according to the order of filling in the tail first and then filling in the head. The padding number is the difference of the length of width and the original string. s.count(sub[,start[,end]]) Returns the number of occurrences of substring sub in string s[start:end]. The optional arguments start and end are interpreted as in slice notation. The default value of the start argument is 0, and the default value of the end is len (s). s.endswith(suffix[,start [,end]]) If the string s[start:end] ends with suffix, True is returned. If the string s[start:end] ends with suffix, False is returned. The default values of start and end are 0 and len(s) respectively. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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) The returned result is as follows: aa bbbb c In the returned result, the number of spaces used by the first "\t" is the difference of the length of tabsize and "aa", that is, 8 - 2 = 6. The number of spaces used by the second "\t" is the difference of the length of tabsize and "bbbb", that is, 8 - 4 = 4. 4-16 s.find(sub[,start[,end]]) If the substring sub is contained in s[start:end), return the index that appears for the first time in the range s[start:end]. If the substring sub is not contained in s[start:end], -1 is returned. s.index(sub[,start[,end]]) Be similar to find(). Raises ValueError when the substring is not found. s.isalnum() If all characters in the string are digits or letters and at least one character exists in the string, True is returned. If any character in the string is not a digit or a letter or no character exists in the string, False is returned. s.isalpha() If all characters in the string are letters and at least one character exists in the string, True is returned. If any character in the string is not a letter or no character exists in the string, False is returned. 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Method Description s.istitle() Checks whether the string is a title string. If lowercase letters are not followed by uppercase letters and only uppercase letters are followed by lowercase letters, True is returned. If lowercase letters are followed by uppercase letters or any lowercase letter is followed by uppercase letters, False is returned. s.isupper() If all letters in the string are uppercase, True is returned. If any letter in the string is lowercase, False is returned. s.join(seq) Returns the string that connects all strings in the sequence seq. If seq is a list or a tuple, the item in the list or the tuple must be a string. s.ljust(width[,fillchar]) Returns a string whose length is equal to width. If the length of the string is smaller than the width, use fillchar whose default value is a space, to pad the right segment of the string. If the length of the string is equal to or greater than the width, the string is returned. s.lower() Returns a copy of the string converted into lowercase. s.lstrip([char]) Removes the character at the beginning of the string, and then returns the s[n:] string. The letter n refers to the location index of the first character that is not located in chars. In addition, the first character belongs to the string. If you do not set the value of char or char to None, left blank characters in the string are removed by default. s.replace(old, new [, count]) Returns a string where all the substrings old are replaced by the substrings new. If count is specified, then a maximum of count times can be replaced. The old and new arguments are of the string type. The count argument is an integer. s.rfind(sub [,start [, end]]) Returns the highest index in the string where substring sub is found, so that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. -1 is returned in case of failure. s.rindex(sub[,start[,end]]) Be similar to rfind(). Raises ValueError when the substring sub is not found. s.rjust(width[,fillchar]) Returns a string whose length should be width. If the length of a string is smaller than the width, pad fillchar (a space by default) on the left of the string until the length of a string is equal to the width. If the length of a string is equal to or greater than the width, the string is returned. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 l " '1,,2'.split(',') "p_returns " ['1', '', '2'] "). l " '1, 2, 3'.split(', ') " returns " ['1', '2', '3'] "). l "''.split(',') " returns "[] "). s.splitlines([keepends]) Splits the string into multiple substrings by lines, arranges the substrings into a list, and then returns the list. If you set keepends to True, the line feed character is maintained for the substrings. If you do not set keepends to True, the line feed character is not maintained for the substrings. s.startswith(prefix [, start [, end]]) If the s[start:end] sunstring begins with prefix, True is returned. If the s[start:end] sunstring does not begin with prefix, False is returned. The prefix parameter is a string. The start parameter is an integer and the default value is 0. The end parameter is an integer and the default value is len(s). 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Method Description s.swapcase() Returns a copy of the string. In addition, all the uppercase characters in the string are changed to lowercase characters, and all the lowercase characters are changed to uppercase characters. 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]) Returns a converted string. All the characters occurring in delchars are removed from the copy string. Other characters are converted according to mapping relations in table. The augment table must be a string that contains 256 characters arranged in sequence. The mapping relation is as follows: The values of the ASCII codes mapping the string are used as indexes, and the characters mapping to the indexes in table are taken out. s.upper() Returns a copy of the string. In addition, all the lowercase letters in the copy string are changed to uppercase letters. s.zfill(width) Returns the string whose length is width. If the length of the string is smaller than the width, return the copy string and pad 0 at the left side of the copy string. If the length of the string is greater than the width, the string is returned. Special Character Special characters and their descriptions are listed in Table 4-9. Table 4-9 Special Character Name Description \\ Backslash \' Single quotation marks \" Double quotation marks \a Bell \b Space character \e Escape \0 Null \n Newline character and equals to \x 0a and \cJ \v Perpendicular tab and equals to \x0b and \cK Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-19 M2000 iSStar User Guide 4 HSL Reference Name Description \t Horizontal tab and equals to \x09 and \cJ \r Enter character and equals to \x0d and \cM \f Form feed character and equals to \x0c and \cJ \OOO octal(000-377) \xhh hex(x00-xff) \un Unicode character, n is a Unicode character shown by four hex numbers 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 d Signed decimal integer i Signed decimal integer o Unsigned octal numeral u Unsigned integer x Unsigned hexadecimal numeral X Unsigned hexadecimal numeral e Floating point number. It is represented in a scientific expression. E Floating point number. It is represented in a scientific expression. f Floating point number g Floating point number. If the accuracy does not reach 0.0001, it is represented in a scientific expression. c Represents an ASCII integer as single character r Indicates a string format. It is the return value of the repr () function of the internal call object. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Character Description s Indicates a string format. It is the return value of the str() function of the internal call object. 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. List Object Method For details of the list object method, see Table 4-11. Table 4-11 List object methods Method Description L.append(x) Appends an item at the end of L. L[len(L):] = [x] is also applicable. 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) Inserts an element in a specified position. The i parameter is the index of the position of the element to be inserted. The parameter x is the element to be inserted. L.remove(x) Removes the first item valued x. If no x exists in L, the script execution fails. L.pop([i]) Removes an item in a specified position from a list, and then returns the deleted item. If the default value is selected for i, L.pop() deletes the last item in the list and then returns the last item. 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) Returns the times of x in L. L.sort() Sorts the items of L in ascending order. L.reverse() Reverses locations of the items in list. Tuple Tuple is a constant list. This section describes the tuple and provides some examples. You can refer to this section to perform relevant operations. l Tuple is a constant list. Tuple has no such methods as pop, remove, and insert. l Tuple is displayed by (), for example, a=(0,1,2,3). The round brackets can be omitted. l Tuple can return elements or sub-tuples by using subscripts. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-21 M2000 iSStar User Guide 4 HSL Reference l Tuple can be used to assign values for multiple variables. Example t=(1,2) a,b = t Print("%d"%a) Print("%d"%b) Result 1 2 4.2.3 Dictionary A dictionary has a random storage structure. Each element in the dictionary is called a pair. A pair contains two parts: key and value. Key can be an integer or a string, and value can be the data of random types. You can get value by D[key]. Duplicate keys are not available in the dictionary. Operations For details of operations on dictionary objects, see Table 4-12. 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.) key not in dic 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()..) Example 1: Assigning Application dic1 = {'sun':1,'moon':2} dic2 = {'food':{'ham':1,'egg':2}} #Output dic1 and dic2. Print(dic1) Print(dic2) Print("----------------------------") #Output the keys corresponding to dic1 and dic2. Print("dic1['moon'] = " + str(dic1['moon']) ) 4-22 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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} Example 2 in, not in dic = {'sun':1,'moon':2} #Determine whether "moon" is a key in dic. If yes, return True. If no, return False. Print(("moon" in dic)) #Determine whether "moon"is a key in dic. If no, return True. If yes, return False. Print(("moon" not in dic)) Result True False Example 3 Get the length of the dic by the function len(). dic = {'sun':1,'moon':2} #Export the length of the dic. Print(len(dic)) Result 2 Dictionary Object Methods For detailed methods about dictionary objects, see Table 4-13. Table 4-13 Methods about dictionary objects Method Description dic .clear() Clears dic. dic.values() Returns the value. dic.has_key(k) Checks whether the key k exists in dic. dic.copy() Copies contents of the object. dic.items() Are a copy of a's list of (key, value) pairs. dic.keys() Copies all the keys. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-23 M2000 iSStar User Guide 4 HSL Reference Method Description dic.update([b]) Updates dic according to b. The letter b can refer to a dictionary type or a list, for example, [(key,value)]). dic.fromkeys(seq[,value]) Creates a dictionary and uses the elements in seq as acquisition keys. The values of all the elements are set to value. If the value of an element is not set to value, then set the value to None. dic.setdefault(k[,x]) If k is in dic, the return key k maps to the following value: dic [k]. Otherwise, return x and add (dic[k], x) in the dictionary. dic.get(k[,x]) Returns the value of k. dic.pop(k[,x]) Removes and returns an arbitrary (key, value) pair. 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() Gets an iterator over the keys of the mapping. dic.itervalues() Gets an iterator over the values of the mapping. 4.2.4 File This section describes a file which provides basic operations for files, such as, opening, reading, and writing files. File Object Methods Before you operate a file object, obtain it by calling Open(filename[,mode[,bufsize]]). Table 4-14 lists the description of Open(filename[,mode[,bufsize]]). 4-24 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Table 4-14 Open function description Function Description Open(filename[,mode[,bufsize]]) Returns a new file object, where the filename indicates the name of the file to be opened. The default value of mode, which indicates the mode of opening a file, is r. The modes for opening files and the related meanings are as follows: l r: opens a file to read. l w: opens a file to write. l a: opens a file to append. The file is automatically moved to the end. l r: opens a file to read and write. l w+: truncates or clears a file, and then opens the file to read and write. l a+: opens a file to read and write. The file is automatically moved to the end. l t: opens a file in text mode. l b: opens a file in binary mode instead of text mode. The bufsize argument specifies the desired size of the file. The values and related meaning are as follows: l 0 means unbuffered. l 1 means line buffered. l Any other positive value means using a buffer of (approximately) that size. l A negative means using the default value. l If it is omitted, the default value is used. Table 4-15 lists the description of file object methods. Table 4-15 File object methods Mame Description close() Closes a file. A closed file cannot be read or written any more. After the file is closed, any operations that need to read or write the file stop the program. Calling close() more than once is allowed. flush() Clears the internal buffer. For some file objects, this function may have no operation effect. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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]) Reads the contents of a line. The content contains the line feed character at the end of the line. If the file ends with an incomplete line, no line feed character may exist. The return value is a string. If the size argument exists and is not negative, the maximum of the returned string is size, including the line feed character. If the file starts with EOF, a null string is returned. NOTE The returned string contains null characters ('\0') if they occurred in the input information. readlines() Reads the contents at the end of a file. EOF is the end mark of a file. The return value is a list. The elements in the list are of the string type. The content of each line is used as an item. seek(offset[, whence]) Sets the current location for the file. No return value is available. The value of the whence parameter can be one of the following: l 0: indicates the absolute location of the file. l 1: indicates the relative location of the current location. l 2: indicates the relative location of the end of the file. The default value for whence is 0. If a file is opened in an additional way, that is, 'a' or 'a+', then cancel all the seek() operations when you write contents into a file. If you open a file to only write contents into a file ('a'), this method actually has no operation effect. When you open a file to read contents ('a+'), you can still write contents into a file. If a file is opened in text mode ('t'), you can use only tell() to return the deviation value. Other values may incur unknown results. Not all the file objects can use this function. tell() Returns the current position of the file. truncate([size]) Truncates a file to a specified size. If there is the optional augment size, truncates the size of the file. By default, size means truncating a file to a current position. NOTE l The current file position is not changed. l If a specified size exceeds the current size of the file, the result depends on the operating system. Possibilities include that the file may remain unchanged, increase to the specified size as if zerofilled, or increase to the specified size with undefined new content. 4-26 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Mame Description write(str) Writes a string to the file. No return value is available. Because of buffering, the string may not actually show up in the file until the flush() or close() method is called. writelines(sequence) Writes the sequence into a file. No return value is available. A sequence can be any iteration object that generates a string. Generally, a sequence is a string list. closed Changes the state of a file object. The existing state of a file object can be represented by objects of the bool type. This is a read-only attribute and can be changed through close(). The function is not applicable for all file objects. Example # Read the file by byte def readBytes ( filePath ) # Open the file in read-only mode f = Open( filePath, "r") c=f.read(1) buf = c while c #Print(c) c = f.read(100) buf = buf + c end f.close() return buf end # 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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. 4.3 HSL Built-In Function This section describes the HSL built-in function that provides a group of object-specific operation functions. 4.3.1 List of Built-In Functions This section lists built-in functions and describes their features. 4.3.2 Example of Data Operation Function This section describes the method of using the data operation function through the following example. 4.3.3 Example of Type Conversion Function This section describes the method of using the type conversion function through the following function. 4-28 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference 4.3.4 Example of Other Functions This section describes the method of using other functions through the following example. 4.3.1 List of Built-In Functions This section lists built-in functions and describes their features. Data Operation Functions Function Description abs(x) Returns the absolute value of x. x is of numeric type. If a complex number is given, the return value is the modulo of the complex number. cmp(x,y) Compares x and y. If x < y, return a negative number. If x == y, return zero. If x > y, return an integer. Types of x and y are not limited. The function can compare any two objects and return the result. Some insignificant comparison, for example, between file objects, may cause exception. coerce(x,y) Converts x and y into the same numeric type and returns as a tuple. complex(real [, imag]) Creates a complex number. The real part is real, and the imaginary part is imag . If imag is not available, the imaginary part is 0j. divmod(a,b) Returns a tuple containing quotient and remainder. For an integer, returns (a / b , a % b ). For a floating number, returns (math.floor(a / b ), a % b ). len(s) Returns a sequence (string, tuple, or list) or the number of entries in the dictionary (returns the length of the sequence of dictionary). max(s [, args, ...]) For a single parameter, returns the largest value in sequence s. For several parameters, returns the parameter with the largest value. For a sequence invoking several parameters, parameters in each list are compared as a whole. min(s [, args, ...]) For a single parameter, returns the smallest value in sequence s. For several parameters, returns the parameter with the smallest value. For a sequence invoking several parameters, parameters in each list are compared as a whole. pow(x, y [, z]) Returns the power value of x ** y, where y is the index. If z is given, return the result of ((x ** y) % z). round(num) Returns the floating point value x rounded to n digits after the decimal point. If n is omitted, the default value is 0. Related Instances Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-29 M2000 iSStar User Guide 4 HSL Reference Type Conversion Functions Function Description float(x) Converts a number of the string type or the numeric type to a number of the floating type. If x is a string, the string can contain only number characters, and the number of which should be no less than one. hex(x) Converts an integer into a hexadecimal string. int(x [, base]) Converts a number or string into a decimal numeral. If x is a string, the string can contain only number characters, and the number of which should be not less than one. The optional parameter base represents the base or basis of the conversion and should be an integer ranging from 2 to 36. The default value for base is 10. If x is a digit, you do not need to present base. If you present base when x is a digit, errors occur. list(s) Returns a list whose items and ordering of the items are the same with that of the parameters. long(x [, base]) Converts a number or string into a long integer. If x is a string, the string can contain only number characters, and the number of which should be more than one. The optional parameter base represents the base or basis of the conversion and should be an integer ranging from 2 to 36. The default value for base is 10. If x is a digit, you do not need to present base. If you present base when x is a digit, errors occur. oct(x) Converts an integer or a long integer into an octal string. ord(c) Returns the ASCII or Unicode code value of a specified character. For a common character, a value from 0 to 255 is returned. For a Unicode character, a value from 0 to 65535 is returned. The c parameter is a string and contains only one character. chr(i) Returns the character whose ASCII code is i. The i parameter is an integer and ranges from 0 to 255. repr(object) Returns the object in string type. The result is the same with that using single counter quotation mark '. The return string generates an object whose value is consistent with that generated by transferring object to eval(). str(object) Returns the object in the printable string type. tuple(s) Returns a tuple. The items and the sequence of the items are the same with those of the parameters. Related Instances 4-30 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference String Conversion Functions Function Description unichr(i) Returns the character whose Unicode code is i. The i parameter is an integer and ranges from 0 to 65535. unicode(string[,encoding[,errors]]) Converts a string to a Unicode string. The encoding parameter is a string and specifies the data coding of the string. The default coding type in the existing system is used if you do not select a coding type. The errors parameter defines the processing mode of the wrong coding. The mode can be 'stritct', 'replace' or 'ignore'. The default mode is 'strict'. NOTE If the given data coding is unknow, errors occur. 4.3.2 Example of Data Operation Function. Other Common Functions Function Description range([start,]stop[,step]) Creates a universal function of arithmetic progression list, which is often used in a loop. The argument must be an unformatted integer. When step is omitted, the default value is 1. When start is omitted, the default value is 0. When neither step nor start is omitted, an unformatted integer list [start, start+step,start +2*step,...] is returned. If step is positive, the last element is the maximum value of start+i*step which is smaller than stop; if step is negative, the last element is the maximum value of start + i*step which is greater than stop. Step cannot be zero; otherwise, ValueError is returned. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 FileName is a script file with no error. It indicates the call function runs normally and the function returns 0. l FileName is a script file but with errors. The call function throws an exception. l FileName does not exist. The call function returns error code 4. l FileName exists but is not a script file. The call function returns error code 6. l FileName is an Exit(errID) function. The errID is returned if the script can be performed normally. NOTE For the files with no extension, process them as the script files. Import(FileName) Imports the script module and supports nesting (that is, importing from A to B, and B to C ). When the import is running properly, the return value is a module object. Otherwise, the return value is None. Related Instances 4.3.2 Example of Data Operation Function This section describes the method of using the data operation function through the following example. 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)) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 4 HSL Reference Result n1 n2 n3 n4 n5 n6 = = = = = = 1 -1 (10+20j) (1, 2) 9 0 4.3.3 Example of Type Conversion Function This section describes the method of using the type conversion function through the following function. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4-33 M2000 iSStar User Guide 4 HSL Reference int function convert an string to a integer 11 3 17 4.3.4 Example of Other Functions This section describes the method of using other functions through the following example. 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] Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5 HFC Library Reference About This Chapter The iSStar provides various library functions, such as Time functions, Input and Output functions, GetError Function, GetError Function, Directory Operation Function and so on. These functions are called High level Foundation Classes (HFC) functions. HFC functions help you to compile simple scripts and facilitate debugging and maintenance. 5.1 NE Operation Function 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. 5.2 MML Message Parsing Function This describes the MML message parsing functions. By using these functions, you can query a message for the information such as the parameters, entries, records, and attribute values. In addition, you can output the obtained information in the tuple format, thus knowing the execution of MML commands on the NEs. 5.3 Alarm Message Parsing Function This describes the alarm message parsing functions. Using these functions, you can obtain the information about the alarms in a message, such as alarm severity and alarm location information. This facilitates future maintenance. 5.4 Database Operation Function The database operation module provides the query operation interface for alarms, performances, and the configuration library. 5.5 Alarm Operation Function This describes the alarm operation function. This function enables you to send to the M2000 the detected exceptions during the running of a script. In this way, you can monitor and manage the exceptions occurred on the network. The alarms that can be sent are fault alarms, clearance alarms, and event alarms. 5.6 OM Operation Function This describes the OM operation function. This function enables you to obtain the version number of the NM software, record the operations of a script, and generate logs. 5.7 Type Conversion Function Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-1 M2000 iSStar User Guide 5 HFC Library Reference 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.1 NE Operation Function 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. 5.1.1 Overview of NE Operation Function This describes the basic functions and procedures of NE operation functions. 5.1.2 Function: ConnectNE This describes the Connect NE function. This function enables you to specify the NE for a task. 5.1.3 Function: GetNELst This describes the GetNELst function. This function enables you to obtain the name list of all the NEs managed by the M2000. The NEs refer to both connected and disconnected NEs. 5.1.4 Function: GetNELstByType This describes the GetNELstByType function. This function enables you to obtain the name list of all the NEs managed by the M2000 by NE type. The NEs refer to both connected and disconnected NEs. 5.1.5 Function: GetNEName This describes the GetNEName function. This function enables you to obtain the name of the NE being operated. 5.1.6 Function: GetNEFDN This describes the GetNEFDN function. This function enables you to obtain the FDN of the specified NE. If NEName is default, the FDN of the current NE is obtained. FDN is a unique identification of an NE in the topology, such as .0.4.1. 5.1.7 Function: GetNEIP This describes the GetNEIP function. This function enables you to obtain the IP address of the specified NE. If NEName is default, the IP address of the current NE is obtained. 5.1.8 Function: GetNEVer This describes the GetNEVer function. This function enables you to obtain the version number of the specified NE. If NEName is default, the version number of the current NE is returned. 5.1.9 Function: GetNEType This describes the GetNEType function. This function enables you to obtain the type of the specified NE. If NEName is default, the type of the NE that is operated by the current task is returned. 5.1.10 Function: GetNEStatus This describes the GetNEStatus function. This function enables you to obtain the status of the specified NE. If NEName is default, the status of the NE currently operated is returned. 5.1.11 Function: SendMML This describes the SendMML function, which enables you to issue MML commands to the NE that is operated currently. 5.1.12 Function: GetMMLReport This describes the GetMMLReport function. This function enables you to obtain and clear the messages in the buffer. 5.1.13 Function: GetAllMMLReport Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-3 M2000 iSStar User Guide 5 HFC Library Reference 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. 5.1.1 Overview of NE Operation Function This describes the basic functions and procedures of NE operation functions. 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.2 Function: ConnectNE Selects the NE that is operated by the current task. 5.1.3 Function: GetNELst Returns the name list of all the NEs managed by the M2000. The NEs refer to both connected and disconnected NEs. 5.1.4 Function: GetNELstByType Returns the name list of all the NEs managed by the M2000 by NE type. The NEs refer to both connected and disconnected NEs. 5.1.5 Function: GetNEName Returns the name of the NE that is operated by the current task. 5.1.6 Function: GetNEFDN Returns the FDN of the specified NE, or the FDN of the connected NE if NEName is default. 5.1.7 Function: GetNEIP Returns the IP address of the specified NE, or the IP address of the connected NE if NEName is default. 5.1.8 Function: GetNEVer Returns the version number of the specified NE. 5.1.9 Function: GetNEType Returns the type of the specified NE. 5.1.10 Function: GetNEStatus Returns the status of the NE that is operated by the current task. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Function Description 5.1.11 Function: SendMML Issues MML commands to the NE that is operated by the current task. 5.1.12 Function: GetMMLReport Returns and clears the message with the specified index number in the buffer. 5.1.13 Function: GetAllMMLReport Returns and clears all MML messages in the buffer. 5.1.14 Function: ClearMMLBuffer Clears all messages in the buffer to release system resources. 5.1.15 Function: SetMMLBufferSize Sets the size of the MML message buffer. Procedure Figure 5-1 shows how to use NE operation functions to manage NEs. Figure 5-1 Procedure for using NE operation functions The procedure is as follows: Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-5 M2000 iSStar User Guide 5 HFC Library Reference 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. Issue MML commands. Issue MML commands by referring to 5.1.11 Function: SendMML. The returned message shows whether the commands are successfully issued. NOTE The return value of the function described in 5.1.11 Function: SendMML only shows whether the commands are successfully issued. To check the execution details, you need to obtain the message by calling the function described in 5.1.12 Function: GetMMLReport or 5.1.13 Function: GetAllMMLReport. 3. Run the commands on the NE. 4. The NE returns messages which are then saved in the buffer. Each task has an individual buffer. After an MML command is issued to the NE, the returned MML message is saved in the buffer. 5. Obtain the message. You can obtain the message by calling the function described in 5.1.12 Function: GetMMLReport or 5.1.13 Function: GetAllMMLReport. NOTE After you obtain the message, it is removed from the buffer. 6. Clear the buffer. To save system resources, you can delete all the messages in the buffer by referring to 5.1.14 Function: ClearMMLBuffer. NOTE After the task is complete, the buffer is cancelled. 5.1.16 Example of NE Operation Function shows the examples. 5.1.2 Function: ConnectNE This describes the Connect NE function. This function enables you to specify the NE for a task. Synopsis ConnectNE(NEName) Note 5-6 l You must call this function to select the required NE. Then, after the operation is complete, you can issue commands to the NE. l A task is created after the operation. All the operations related to this task apply to this NE. If you need to operate other NEs, you must call this function again to select other NEs and create new tasks. l You can select only the NEs that are properly connected to the M2000. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description NEName NEName is a string. It indicates the name of an NE. 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:; MML Message Output 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-7 M2000 iSStar User Guide 5 HFC Library Reference 5.1.3 Function: GetNELst This describes the GetNELst function. This function enables you to obtain the name list of all the NEs managed by the M2000. The NEs refer to both connected and disconnected NEs. Synopsis GetNELst() Note None Parameter Description None Return Value l The return value is a list. If the function is called successfully, the name list of all the NEs managed by the M2000 is returned. Otherwise, an empty list is returned. l Each element in the list is a string indicating the NE name. Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example # Get the NE list. nelist = GetNELst() # 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 5.1.4 Function: GetNELstByType This describes the GetNELstByType function. This function enables you to obtain the name list of all the NEs managed by the M2000 by NE type. The NEs refer to both connected and disconnected NEs. 5-8 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. l Each element in the list is a string indicating the NE name. Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example # Get the NE list based on NE type. rncLst = GetNELstByType("RNC") Print('GetNELstByType("RNC") return: ') Print(rncLst) Result GetNELstByType("RNC") return: ['rnc01', 'rnc02', 'rnc03', 'rnc111', 'rnc199', 'rncd1', 'rncme', 'rncreal'] Related Example 5.1.5 Function: GetNEName This describes the GetNEName function. This function enables you to obtain the name of the NE being operated. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-9 M2000 iSStar User Guide 5 HFC Library Reference 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 5.1.6 Function: GetNEFDN This describes the GetNEFDN function. This function enables you to obtain the FDN of the specified NE. If NEName is default, the FDN of the current NE is obtained. FDN is a unique identification of an NE in the topology, such as .0.4.1. 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Return Value The return value is a string. l If you have specified the NE, its FDN is returned. l If no NE is specified but an NE is operated, the FDN of this NE is returned. l If no NE is specified, no NE is operated, or the specified NE does not exist, a null string is returned. NOTE If the specified NE is disconnected from the M2000, a null string is returned. Error Handling If errors occur, you can obtain error information by referring to 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example 1 #Connect the NE rnc001. ConnectNE("rnc001") #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 5.1.7 Function: GetNEIP This describes the GetNEIP function. This function enables you to obtain the IP address of the specified NE. If NEName is default, the IP address of the current NE is obtained. Synopsis GetNEIP([NEName]) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-11 M2000 iSStar User Guide 5 HFC Library Reference 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 If you have specified the NE, its IP address is returned. l If no NE is specified but an NE is operated, the IP address of this NE is returned. l If no NE is specified, no NE is operated, or the specified NE does not exist, a null string is returned. NOTE If the specified NE is disconnected from the M2000, a null string is returned. Error Handling If errors occur, you can obtain error information by referring to 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example 1 #Connect the NE rnc001. ConnectNE("rnc001") #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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.1.8 Function: GetNEVer This describes the GetNEVer function. This function enables you to obtain the version number of the specified NE. If NEName is default, the version number of the current NE is returned. 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 If you have specified the NE, its version number is returned. l If no NE is specified but an NE is operated, the version number of this NE is returned. l If no NE is specified, no NE is operated, or the specified NE does not exist, a null string is returned. NOTE If the specified NE is disconnected from the M2000, 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 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-13 M2000 iSStar User Guide 5 HFC Library Reference Related Example 5.1.9 Function: GetNEType This describes the GetNEType function. This function enables you to obtain the type of the specified NE. If NEName is default, the type of the NE that is operated by the current task is returned. 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 If you have specified the NE, its NE type is returned. l If no NE is specified but an NE is operated, the type of this NE is returned. l If no NE is specified, no NE is operated, or the specified NE does not exist, a null string is returned. NOTE If the specified NE is disconnected from the M2000, 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 1 #Connect the NE ne1. ConnectNE("ne1") #Get the NE type. neType = GetNEType() Print('GetNEType() return: ') Print(neType) 5-14 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result of Example 2 GetNEType() return: RNC Related Example 5.1.10 Function: GetNEStatus This describes the GetNEStatus function. This function enables you to obtain the status of the specified NE. If NEName is default, the status of the NE currently operated is returned. 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 If you have specified an NE, the status of this NE is returned. l If no NE is specified but an NE is operated, the status of this NE is returned. l If no NE is specified, no NE is operated, or the specified NE does not exist, 0 is returned. Error Handling If errors occur, you can obtain error information by referring to 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example 1 #Connect the NE rnc001. ConnectNE("rnc001") #Get the status of the connected NE. neStatus = GetNEStatus() Print("neStatus: "+ str(neStatus)) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-15 M2000 iSStar User Guide 5 HFC Library Reference 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 5.1.11 Function: SendMML This describes the SendMML function, which enables you to issue MML commands to the NE that is operated currently. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference ConnectNE("neName") #Sending MML command sendmml = SendMML("LST CELL:;") if sendmml==1 Print('SendMML("LST CELL:;") success.') else Print('SendMML("LST CELL:;") failure!') end Result SendMML("LST CELL:;") success. MML Message Output LST CELL:; +++ NE 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 No. 0 0 1 1 20 20 11 11 12 12 (Number of results = --- 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 5.1.12 Function: GetMMLReport This describes the GetMMLReport function. This function enables you to obtain and clear the messages in the buffer. Synopsis GetMMLReport([Idx]) Note l After an MML command is issued to the NE, the returned MML message is saved in the buffer. Each task has an individual buffer. You can set the buffer size by referring to 5.1.15 Function: SetMMLBufferSize. l The messages accumulates in the buffer. When the number of stored messages exceeds the maximum, new messages are lost. You need to obtain and clear the messages in the buffer. l After a task is complete, the corresponding buffer is cancelled and the messages are deleted. l The messages in a buffer are identified by the location index. The location index starts from 0 and increases in sequence. After you extract a message with the position index as a, it is deleted from the buffer. Then, the location indexes that are greater than a are changed correspondingly. For example, four messages, 0, 1, 2, and 3 are available in the buffer. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-17 M2000 iSStar User Guide 5 HFC Library Reference 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference --- END The first 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 Service Login Time 10.161.24.166 NULL 2008-01-10 14:15:50 NULL END MML Message Output +++ 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) --- 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-19 M2000 iSStar User Guide 5 HFC Library Reference --- END Related Example 5.1.13 Function: GetAllMMLReport This describes the GetALLMMLReport function. This function enables you to obtain and clear all the MML messages in the locale buffer. Synopsis GetAllMMLReport() Note l For the tasks that may generate MML messages, each one has an individual buffer. You can set the buffer size by referring to 5.1.15 Function: SetMMLBufferSize. l The MML messages accumulates in the buffer. When the number of stored messages exceeds the maximum, new messages are lost. You need to obtain and clear the messages in the buffer. l After a task is complete, the buffer is cancelled and the messages are deleted. Parameter Description None. Return Value l The return value is a list. l The elements in the list are the obtained MML messages. l If the message fails to be obtained, a null string is returned. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Print("There are %d reports:"%(len(allReport))) for rpt in allReport Print("Report = %s"%rpt) end 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 MML Message Output 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 Issue 01 (2008–12–08) NodeB name Local cell ID Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Subrack No. 5-21 M2000 iSStar User Guide 5 HFC Library Reference 0 CELL1 1 1 CELL2 1 (Number of results = 2) --- NODEB1 NODEB1 0 1 3 3 END Related Example 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. 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. l 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference MML Message Output LST VER:; +++ NE 2007-03-26 20:32:25 O&M; #31280 %%/*14263*/LST VER:;%% RETCODE = 0 Execution succeeded. --- END LST VER:; +++ NE 2007-03-26 20:32:25 O&M; #31280 %%/*14263*/LST VER:;%% RETCODE = 0 Execution succeeded. --- END Related Example 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. Synopsis SetMMLBufferSize([Len]) note l After an MML command is issued to an NE, the returned MML message is saved in a buffer. Each task has an individual buffer. l The messages accumulates in the buffer. When the number of stored messages exceeds the maximum, new messages are lost. l The SetMMLBufferSize(len) function can initialize the buffer, that is, clear the existing messages in it. Parameter Description Parameter Description Len is an integer and >= -1, with the default value as 1000.The following different values for len have different meanings: Len Issue 01 (2008–12–08) l When len is equal to -1, you can infer that all messages are allowed in the buffer. l When len is equal to 0, messages are not buffered. l When len is greater than 0, the value of len is the maximum number of allowable messages in the buffer. After the value of len reaches the maximum, MML commands cannot be issued. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-23 M2000 iSStar User Guide 5 HFC Library Reference 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 MML Message Output LST VER:; +++ 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 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. 5-24 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-25 M2000 iSStar User Guide 5 HFC Library Reference freeSpace = int(freeSpaceValue[:-1]) # Check whether the free space is lower than 50%. if freeSpace < 50 # 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Checking the NE NE99. Connecting the NE NE99 failed. List of NEs whose free space of hard disks are lower than 50%. ['NE96'] The routine health check ends. MML Message Output +++ NE 2007-01-20 15:06:53 O&M #656908 %%/*12218*/DSP BAMSRV:;%% RETCODE = 0 Execution succeeded. BAM server state(CPU&MEM) ------------------------CPU(%) = 3% MEM(%) = 75% (Number of results = 1) BAM server state(Logical harddisk) ---------------------------------Logical harddisk = C:\ Total space(M) = 9546 Free space(M) = 5622 Free space(%) = 58% Logical Total Free Free harddisk space(M) space(M) space(%) = = = = D:\ 9537 2961 31% (Number of results = 2) --- END 5.2 MML Message Parsing Function This describes the MML message parsing functions. By using these functions, you can query a message for the information such as the parameters, entries, records, and attribute values. In addition, you can output the obtained information in the tuple format, thus knowing the execution of MML commands on the NEs. 5.2.1 Overview of MML Message Parsing Function This describes the basic functions and procedures of MML message parsing functions. 5.2.2 MML Message Format This describes the format of MML messages and the meaning of each part. 5.2.3 Function: ParseMMLRpt This describes the ParseMMLRpt function. This function enables you to convert the MML message into a format that can be recognized by other MML message parsing functions. You must call this function before calling other message parsing functions. 5.2.4 Function: GetSourceName This describes the GetSourceName function. This function enables you to obtain the source identity of an MML message, that is, equipment identification. A source identifier identifies the physical area of an message output. 5.2.5 Function: GetReportDate Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-27 M2000 iSStar User Guide 5 HFC Library Reference 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 message。For 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.2.18 Function: GetAttrValueByIdx This describes the GetAttrValueByIdx function. This function enables you to obtain the specified attribute value from a parse MML message according to the entry number, attribute number, and record number. 5.2.19 Function: GetAttrNameList This describes the GetAttrNameList function. This function enables you to obtain the list of attribute names in the specified entry in an MML message. 5.2.20 Function: GetAttrNum This describes the GetAttrNum function. This function enables you to obtain the number of attributes in the specified entry in an MML message. 5.2.21 Function: GetColumnByName This describes the GetColumnByName function. This function enables you to obtain the data of a column in the specified entry according to the column name. 5.2.22 Function: GetColumnByIndex This describes the GetColumnByIndex function. This function enables you to obtain the data of the specified column according to the column number. 5.2.23 Function: GetRowByIndex This describes the GetRowByIndex function. This function enables you to obtain the data of a record in the specified entry according to the entry number and row number. 5.2.24 Function: GetDataFrmMMLRpt This describes the GetDataFrmMMLRpt function. This function enables you to convert a specified entry into a tuple for report output. 5.2.25 Function: DestroyMMLParser This describes the DestroyMMLParser function. This function enables you to destroy an MM message parsing object so that you can release the system resources for parsing the MM message, and reduce system consumption. 5.2.26 Examples of MML Message Parsing Function This describes the examples of the MML message parsing function and the method of using some functions related to the MML message. 5.2.1 Overview of MML Message Parsing Function This describes the basic functions and procedures of MML message parsing functions. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-29 M2000 iSStar User Guide 5 HFC Library Reference Table 5-2 MML message parsing functions FunctiPon 5.2.3 Function: ParseMMLRpt Description Parses MML message strings. Returns the source identifier of an MML message. 5.2.4 Function: GetSourceName A source identifier identifies the physical area of an message output. Generally, it is an equipment identifier. You can specify source identifiers when specifying the equipment, for example, office name. 5.2.5 Function: GetReportDate Returns the creation date of an MML message. 5.2.6 Function: GetReportTime Returns the creation time of an MML message. Returns a time adjustment flag. 5.2.7 Function: GetTimeAdjustFlag 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. For example, when the DST starts, the time adjustment flag helps the M2000 to solve the time overlaps before and after the DST. Returns the MML message service flag. 5.2.8 Function: GetServiceFlag A service flag is used to identify the service types of a message, for example, alarm message or performance message. Returns the MML message serial number. The message serial number maps a task. It uniquely identifies the output message of a task. 5.2.9 Function: GetReportIdx For a command that has large command results, the output needs to be divided into multiple messages which use the same message serial number. In this way, the serial number can identify the messages of the same task. Returns the echo of an MML command. 5.2.10 Function: GetMMLCmd 5-30 The echo of an MML command shows the issued MML command. The echo of a password 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference FunctiPon Description Returns the return codes of an MML message. 5.2.11 Function: GetResultCode Return codes are contained in a system report. The system report refers to the returned message which indicates whether the system has successfully processed the MML report. A return code is represented by a 32-bit decimal positive integer. The value 0 indicates that the system process is successful. Other return codes are defined by the NE applications. Returns the remarks for a return code of an MML message. 5.2.12 Function: GetResultCause The remarks of a return code is contained in a system report. The system report refers to the returned message which indicates whether the system has successfully processed the MML report. If the command is successfully run, the remark shows success. If a command is not successfully run, the remark gives the cause. This helps you to locate the error. Returns the number of entries in an MML message. 5.2.13 Function: GetObjNum An MML message can contain multiple entries. The serial numbers of the entries count from 0. 5.2.14 Function: GetObjTitle Returns the title of an entry in an MML message. 5.2.15 Function: GetRecordNum Returns the number of records in the specified entry in an MML message. An entry can contain multiple records. The serial number of the records start from 0. Returns the tips of an MML message. 5.2.16 Function: GetTips 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.2.17 Function: GetAttrValueByName Returns the attribute value of a record in the specified entry according to the attribute name. 5.2.18 Function: GetAttrValueByIdx Returns the attribute value of a record in the specified entry according to the attribute location. 5.2.19 Function: GetAttrNameList Returns the list of attribute names in the specified entry in an MML message. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-31 M2000 iSStar User Guide 5 HFC Library Reference FunctiPon Description 5.2.20 Function: GetAttrNum Returns the number of attributes in the specified entry in an MML message. 5.2.21 Function: GetColumnByName Returns the data in a column in the specified entry according to the column name. 5.2.22 Function: GetColumnByIndex Returns the data in a column in the specified entry according to the column number. 5.2.23 Function: GetRowByIndex Returns the data in the specified record in the specified entry according to the record number. 5.2.24 Function: GetDataFrmMMLRpt Returns the contents of the specified entry and output the contents in the tuple format. 5.2.25 Function: DestroyMMLParser Destroys an MM message parsing object to release the system resources for parsing the MM message. 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 The procedure is as follows: 1. Obtain the MML message. You can obtain the message by calling 5.2.17 Function: GetAttrValueByName or by manually entering the message. Note that you must conform to the format specifications to enter MML messages. Otherwise, the MML message parsing functions fail to parse the messages. For details of MML message format, refer to 5.2.2 MML Message Format. 5-32 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 2. Parse the MML message by calling 5.2.3 Function: ParseMMLRpt. 3. Obtain the required data from the parsed message. 5.2.26 Examples of MML Message Parsing Function shows the examples. 5.2.2 MML Message Format This describes the format of MML messages and the meaning of each part. The format of the MML message is shown in Figure 5-3. For a detailed description of Figure 5-3, refer to Table 5-3. Figure 5-3 MML message format Table 5-3 Description of MML message format SN Field Meaning Description (1) Start identifiers of an MML message. An MML message must start with "+++" as its start identifiers. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-33 M2000 iSStar User Guide 5 HFC Library Reference SN Field Meaning Description (2) Source identity (equipment identification). A source identity identifies the physical area where an output message is generated. You can specify the identity when installing the equipment. It can be obtained through 5.2.4 Function: GetSourceName. (3) (4) Creation date of an MML message. The YYYY-MM-DD format is applied. Creation time of an MML message. The 24 hour clock mode is applied. The expression format is HH:MM:SS. It can be obtained through 5.2.5 Function: GetReportDate. It can be obtained through 5.2.6 Function: GetReportTime. (5) Service message flag of an MML message. A service message flag is used to identify the service type of a message. The meanings of the service report flags are as follows: l TRAFFIC Performance report. Only the performance reports that are actively reported are of the TRAFFIC type. The query reports of performance data are of the O&M type rather than TRAFFIC. l O&M Operation and maintenance report. All session outputs, for example, service configuration and alarm query, belong to the O&M type. l TEST Test report. Only the test reports that are actively reported are of the TEST type. The query reports of test data are of the O&M type rather than TEST. l ALARM Alarm report. Only the alarm reports that are actively reported are of the ALARM type. The query reports of test data are of the O&M type rather than ALARM. It can be obtained through 5.2.8 Function: GetServiceFlag. (6) Serial number. The message serial number maps a task. It uniquely identifies the output message of a task. For a command that has large command results, the output needs to be divided into multiple messages which use the same message serial number. In this way, the serial number can identify the messages of the same task. It can be obtained through 5.2.9 Function: GetReportIdx. 5-34 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference SN Field Meaning Description (7) Command echo. The echo of an MML command shows the issued MML command. The password echo is "*****", namely, five English star symbols. If an MML message is displayed as multiple sub-messages, the command echoes of all the sub-messages are the same. It can be obtained through 5.2.10 Function: GetMMLCmd. (8) Return code. A return code identifies whether the NE system has successfully processed the MML commands. A return code is represented by a 32-bit decimal positive integer. The value 0 indicates that the system process is successful. Other return codes are defined by the NE applications. It can be obtained through 5.2.11 Function: GetResultCode. (9) Remarks of a return code. If the command is successfully run, the remark shows success. If a command is not successfully run, the remark gives the cause, which helps locate the error. It can be obtained through 5.2.12 Function: GetResultCause. (10) Title of entry 0 of the MML message. Specifies the topic of the body. (11) Attribute of entry 0. Obtain the attribute list of the entry through 5.2.19 Function: GetAttrNameList. (12) Attribute value of entry 0. It can be obtained through 5.2.17 Function: GetAttrValueByName and 5.2.18 Function: GetAttrValueByIdx. (13) Entry 0. It is one part of the MML body. It can be obtained through 5.2.14 Function: GetObjTitle. You can obtain the number of the entries by calling 5.2.13 Function: GetObjNum. (14) Record 1 of entry 0. You can obtain the number of records of an entry by calling 5.2.15 Function: GetRecordNum. (15) Sum information of entry 0. The sum information shows the number of records in the body. You can obtain the number of records of an entry by calling 5.2.15 Function: GetRecordNum. (16) Entry 1. It is one part of the MML body. You can obtain the number of the entries by calling 5.2.13 Function: GetObjNum. (17) Issue 01 (2008–12–08) End identifier. An MML message is ended with “ --- END ”. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-35 M2000 iSStar User Guide 5 HFC Library Reference SN Field Meaning Description (18) MML message. You can obtain the MML message by using 5.1.12 Function: GetMMLReport. You can obtain a group of MML messages and clear the buffer by using 5.1.13 Function: GetAllMMLReport. You can create a parsing object flag by using 5.2.3 Function: ParseMMLRpt. l For integrity purpose, the tips of the MML message of certain commands provide further explanation. Tips are displayed before the end mark, and before the additional information, if any. If an end mark does not follow the tip, a blank line separates the tip from the subsequent information. If the output MML message is divided into several sub-messages, the remark is displayed in the last sub-message only. It can be obtained through 5.2.16 Function: GetTips. l Additional information is displayed before the end identifier of the message. If a command generates only one MML message, the additional information can be omitted. If the output of the command result is divided into several MML messages, the additional information is mandatory. l The time offset value and time adjustment flag are available in English MML message only. You can obtain the time adjustment flag by using 5.2.7 Function: GetTimeAdjustFlag. If time adjustment is not required, the flag does not exist in the MML message. CAUTION The indexes of entries, attributes, and records of an MML message count from 0. 5.2.3 Function: ParseMMLRpt This describes the ParseMMLRpt function. This function enables you to convert the MML message into a format that can be recognized by other MML message parsing functions. You must call this function before calling other message parsing functions. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description MMLRpt MMLRpt is a string and is the MML message to be parsed. The iSStar can parse all the MML messages that conform to the MML format specification. For details of the message formats, refer to 5.2.2 MML Message Format. 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 MML Message Output LST VER:; +++ NE 2007-03-26 20:32:25 O&M #31280 %%/*14263*/LST VER:;%% RETCODE = 0 Execution succeeded. --- END Related Example 5.2.4 Function: GetSourceName This describes the GetSourceName function. This function enables you to obtain the source identity of an MML message, that is, equipment identification. A source identifier identifies the physical area of an message output. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-37 M2000 iSStar User Guide 5 HFC Library Reference Synopsis GetSourceName(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 # Parse the MML message. # Get the source equipment identifier from the parsed MML messag Print('GetSourceName() return: %s'%sourceName) Result GetSourceName() return: NE Related Example 5-38 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.2.5 Function: GetReportDate This describes the GetReportDate function. This function enables you to obtain the creation date of an MML message. Synopsis GetReportDate(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-39 M2000 iSStar User Guide 5 HFC Library Reference reportDate = GetReportDate(p) # Get the message date from the parsed MML message. Print('GetReportDate() return: %s'%reportDate) Result GetReportDate() return: 2007-06-21 Related Example 5.2.6 Function: GetReportTime This describes the GetReportTime function. This function enables you to obtain the creation time of an MML message. Synopsis GetReportTime(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference p = ParseMMLRpt(mml) reportTime = GetReportTime(p) # Parse the MML message. # Get the message time from the parsed MML message. Print('GetReportTime() return: %s'%reportTime) Result GetReportTime() return: 15:58:18 Related Example 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. 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 pMMLRpt indicates a parsed MML message object. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-41 M2000 iSStar User Guide 5 HFC Library Reference 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) adjust = GetTimeAdjustFlag(p) Print("GetTimeAdjustFlag(p) return: " + adjust) Result GetTimeAdjustFlag(p) return: DST Related Example 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. Synopsis GetServiceFlag(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Performance report. Only the performance reports that are actively reported are of the TRAFFIC type. The query reports of performance data are of the O&M type rather than TRAFFIC. l O&M OM report. All session outputs, for example, service configuration and alarm query, belong to the O&M type. l TEST Test report. Only the test reports that are actively reported are of the TEST type. The query reports of test data are of the O&M type rather than TEST. l ALARM Alarm report. Only the alarm reports that are actively reported are of the ALARM type. The query reports of test data are of the O&M type rather than ALARM. Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example mml = """ +++ NE 2007-12-07 10:13:53 O&M #71476 %%/*570*/LST CELL:;%% RETCODE = 0 Execution succeeded. 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.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. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-43 M2000 iSStar User Guide 5 HFC Library Reference Synopsis GetReportIdx(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 #Create an MML message parsing object. p = ParseMMLRpt(mml) #Get and output the message serial number. Print("GetReportIdx() : "+ str(GetReportIdx(p))) 5-44 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result GetReportIdx() : 71476 Related Example 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. Synopsis GetMmlCmd(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 (2008–12–08) Major RNC 110134 WGRU Board Not in Position 2005-12-27 15:06:50 Subrack No.=3, Slot No.=8 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware 5-45 M2000 iSStar User Guide 5 HFC Library Reference 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 #Create an MML parsing object. p = ParseAlmRpt(strAlarm) #Get and output the command echo. fl = GetAlmMMLCmd(p) Print('The MML command output of an alarm message is: ' + fl) Result The MML command output of an alarm message is: LST ALMAF: CNT=0; Related Example 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. Synopsis GetResultCode(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 #Create an MML message parsing object. p = ParseMMLRpt(mml) #Get and output the return code. Print("GetResultCode() return: "+ GetResultCode(p) ) Result GetResultCode() return: 0 Related Example 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. Synopsis GetResultCause(pMMLRpt) Note None Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-47 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 #Create an MML message parsing object. p = ParseMMLRpt(mml) #Get and output the remarks of the return code. Print("GetResultCause() return: "+ GetResultCause(p) ) Result GetResultCause() return: Execution succeeded. Related Example 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-48 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Synopsis GetObjNum(pMMLRpt) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. 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 #Create an MML message parsing object. p = ParseMMLRpt(mml) #Get and output the number of entries in the message. Print("GetObjNum() return: "+ str(GetObjNum(p) ) ) Result GetObjNum() return: 1 Related Example Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-49 M2000 iSStar User Guide 5 HFC Library Reference 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. Synopsis GetObjTitle(pMMLRpt, ObjIndex) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. ObjIndex ObjIndex is an integer. It indicates the entry number of the MML message. The serial numbers of the entries count from 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference #Create an MML message parsing object. p = ParseMMLRpt(mml) #Get and output the title of the specified entry. Print("GetObjTitle() return: "+ GetObjTitle(p, 0) ) Result GetObjTitle() return: List cell basic information Related Example 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. Synopsis GetRecordNum(pMMLRpt, ObjIndex) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. ObjIndex ObjIndex is an integer. It indicates the entry number of the MML message. The serial numbers of the entries count from 0. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-51 M2000 iSStar User Guide 5 HFC Library Reference List cell basic information --------------------------Cell ID Cell name NodeB ID NodeB name Local cell ID Subrack No. Subsystem No. 0 0 300 1 1 300 20 20 301 10 10 302 12 12 302 15 3802 3802 (Number 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) Print("GetRecordNum = "+ str(GetRecordNum(p, 0))) #Get and output the number of records in entry Result GetRecordNum()= 6 Related Example 5.2.16 Function: GetTips This describes the GetTips function. This function enables you to obtain the tips of an MML message。For some commands, you need to provide detailed explanations in the form of tips for integrity purpose. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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))) #Get and output the tips. Result GetTips() return: some words Related Example 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. Synopsis GetAttrValueByName(pMMLRpt, ObjIndex, PropName, RecordIdx,Case = 0) Note None Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-53 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. ObjIndex ObjIndex is an integer. It indicates the index of the entries of the MML message. The Nth object in the MML message refers to the Nth MML message. PropIndex PropIndex is a string. It indicates the attribute name of an entry in the MML message. RecordIdx RecordIdx is an integer. It indicates the record number in the MML message. The numbers of the records count from 0. Case Case is an integer. It indicates whether the attribute name is case sensitive. The default value is 0. When Case uses the default value, the attribute name is case sensitive. When Case is valued other numbers, the attribute name is case insensitive. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference #Get and output the attribute value of record 1 with the attribute name “Cell ID” in entry 0. Print("GetAttrValueByName = "+ str(GetAttrValueByName(p,0,"Cell ID",1))) Result GetAttrValueByName() = 1 Related Example 5.2.18 Function: GetAttrValueByIdx This describes the GetAttrValueByIdx function. This function enables you to obtain the specified attribute value from a parse MML message according to the entry number, attribute number, and record number. Synopsis GetAttrValueByIdx(pMMLRpt, ObjIndex, PropIndex, RecordIdx) Note None Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. ObjIndex ObjIndex is an integer. It indicates the entry number in the MML message. The numbers of the entries count from 0. PropIndex PropIdex is an integer. It indicates the attribute number in the MML message. The numbers of the attributes count from 0. RecordIdx RecordIdx is an integer. It indicates the record number in the MML message. The numbers of the records count from 0. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-55 M2000 iSStar User Guide 5 HFC Library Reference 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 5.2.19 Function: GetAttrNameList This describes the GetAttrNameList function. This function enables you to obtain the list of attribute names in the specified entry in an MML message. Synopsis GetAttrNameList(pMMLRpt, ObjIndex) Note None Parameter Description Parameter 5-56 Description pMMLRpt pMMLRpt indicates a parsed MML message object. ObjIndex ObjIndex is an integer. It indicates the entry number in the MML message. The numbers of the entries count from 0. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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) --''' Destination address mask Forward route address 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 Print("GetAttrNameList() return: "+ str(attrNames)) Result GetAttrNameList() return: ['Destination network address', 'Destination address mask', 'Forward route address'] Related Example 5.2.20 Function: GetAttrNum This describes the GetAttrNum function. This function enables you to obtain the number of attributes in the specified entry in an MML message. Synopsis GetAttrNum(pMMLRpt, ObjIndex) Note None Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-57 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description pMMLRpt pMMLRpt indicates a parsed MML message object. ObjIndex ObjIndex is an integer. It indicates the entry number in the MML message. The numbers of the entries count from 0. 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. Print("GetAttrNum() return: %d"%attrNum) Result GetAttrNum() return: 3 Related Example 5.2.21 Function: GetColumnByName This describes the GetColumnByName function. This function enables you to obtain the data of a column in the specified entry according to the column name. 5-58 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Synopsis GetColumnByName(mParser, objIndex, columnName, ignoreCase) Note None. Description Parameter Description mParser mParser indicates the return object of parsing the MML message. objIndex ObjIndex is of integer type. It specifies the number of the entry to be extracted from the MML message. The number counts from 0. columnName columnName is of string type. It refers to the name of the column to be extracted. ignoreCase ignoreCase is of integer type. It indicates whether the value in columnName is case sensitive. When ignoreCase is 0, you can infer that the value is case sensitive. When ignoreCase is not 0, you can infer that the value is case insensitive. The default setting is 0. 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 (2008–12–08) 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 5 HFC Library Reference 10 CELL10 1 (Number of results = 8) --""" NODEB1 10 3 0 1 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 5.2.22 Function: GetColumnByIndex This describes the GetColumnByIndex function. This function enables you to obtain the data of the specified column according to the column number. Synopsis GetColumnByIndex(mParser, objIndex, columnIndex ) Note None. Description Parameter Description mParser mParser indicates the MML message object that is parsed. objIndex ObjIndex is of integer type. It specifies the number of the entry to be extracted from the MML message. The number counts from 0. columnIndex columnIndex is of integer type. It specifes the number of the column to be extracted. The number counts from 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.2.23 Function: GetRowByIndex This describes the GetRowByIndex function. This function enables you to obtain the data of a record in the specified entry according to the entry number and row number. Synopsis GetRowByIndex(mParser, objIndex, rowIndex) Note None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-61 M2000 iSStar User Guide 5 HFC Library Reference Description Parameter Description mParser mParser indicates the return object of parsing the MML message. objIndex ObjIndex is of integer type. It specifies the number of the entry to be extracted from the MML message. The number counts from 0. rowIndex rowIndex is of integer type. It specifies the number of the record to be abstracted. The number counts from 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 1 NODEB1 0 3 0 0 H'2512(9490) 5.2.24 Function: GetDataFrmMMLRpt This describes the GetDataFrmMMLRpt function. This function enables you to convert a specified entry into a tuple for report output. Synopsis GetDataFrmMMLRpt(mParser, objIndex, columnIndexList) Note None Parameter Description Parameter Description mParser mParser indicates the return object of parsing the MML message. objIndex ObjIndex is an integer. It specifies which entry needs to be extracted from the MML message. The serial number of the entries start from 0. columnIndexList columnIndexList is of integer type. It specifies the numbers of the columns to be extracted from the extracted entry. Ignoring this parameter or entering a null sequence list indicates that all the content in a table is extracted. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-63 M2000 iSStar User Guide 5 HFC Library Reference 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) 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference NODEB1 2 3 0 127 H'2512(9490) ------------3 CELL4 1 NODEB1 3 3 0 126 H'2512(9490) ------------4 CELL5 2 NODEB2 4 3 0 125 H'2512(9490) ------------5 CELL6 2 NODEB2 5 3 0 124 H'2512(9490) ------------6 CELL7 2 NODEB2 6 3 0 123 H'2512(9490) ------------10 CELL10 1 NODEB1 10 3 0 1 H'2512(9490) ------------- 5.2.25 Function: DestroyMMLParser This describes the DestroyMMLParser function. This function enables you to destroy an MM message parsing object so that you can release the system resources for parsing the MM message, and reduce system consumption. Synopsis DestroyMMLParser(mparser) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-65 M2000 iSStar User Guide 5 HFC Library Reference 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 mparser is the parsing object of MM messages. 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 5.2.26 Examples of MML Message Parsing Function This describes the examples of the MML message parsing function and the method of using some functions related to the MML message. 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 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 2. By using the 5.1.12 Function: GetMMLReport function, obtain the message returned by the MML command in the buffer. 3. By using the 5.2 MML Message Parsing Function function, parse the message and obtain the information about the status of each frame. 4. By using the Function: NewReport, Function: AddSheet, Function: AddTable, Function: SetTableValue, and Function: SaveReportAs functions, save the parsing results to an .xls report. Example Print('*************Subrack status check starts *************') if ConnectNE('rnc1') == 0 Print('Failed to connect the NE. Please check whether the NE is disconnected.') Exit(0) end 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-67 M2000 iSStar User Guide 5 HFC Library Reference # Save the subrack information. SaveReportAs('Subrackinfo.xls') Print('*************The subrack status check ends*************') 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 5.3 Alarm Message Parsing Function This describes the alarm message parsing functions. Using these functions, you can obtain the information about the alarms in a message, such as alarm severity and alarm location information. This facilitates future maintenance. 5.3.1 Overview of Alarm Message Parsing Function This describes the basic functions and procedures of alarm message parsing functions. 5.3.2 Alarm Message Format This describes the structure, components, and format of an alarm message. 5.3.3 Function: ParseAlmRpt 5-68 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-69 M2000 iSStar User Guide 5 HFC Library Reference 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.3.30 Examples of Alarm Message Parsing Function This gives examples of the alarm message parsing function. You can better understand how to use NE operation functions to perform routine maintenance. 5.3.1 Overview of Alarm Message Parsing Function This describes the basic functions and procedures of alarm message parsing functions. 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 5.3.3 Function: ParseAlmRpt Parses 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 Returns the source identifier of an MML message. A source identifier identifies the physical area of an message output. Generally, it is an equipment identifier. You can specify source identifiers when specifying the equipment, for example, office name. 5.3.5 Function: GetAlmRptDate Returns the creation date of an alarm message. 5.3.6 Function: GetAlmRptTime Returns the creation time of an alarm message. 5.3.7 Function: GetAlmRptNum Returns the number of entries in an alarm message. The Nth entry of an alarm message refers to the Nth alarm. 5.3.8 Function: GetAlmServiceTag Returns the service message flag of the specified alarm in an alarm message. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-71 M2000 iSStar User Guide 5 HFC Library Reference Function Description 5.3.9 Function: GetAlmTimeAdjustFlag Returns 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. For example, when the DST starts, the time adjustment flag helps the M2000 to solve the time overlaps before and after the DST. 5.3.10 Function: GetAlmServiceFlag Returns the service message flag of an alarm message. A service message flag is used for identifying the service type of a message. The service message flag of an alarm message is ALARM. 5.3.11 Function: GetAlmRptIdx Returns the serial number of an alarm message. An alarm serial number uniquely identifies an alarm message. 5.3.12 Function: GetAlmMMLCmd Returns the MML command output of an alarm message. The echo of an MML command shows the issued MML command. The password echo is *****, that is, five asterisks. If an alarm message is displayed as multiple submessages, the command echoes of all the submessages are the same. 5.3.13 Function: GetAlmResultCode Returns the return codes of an alarm message. Return codes are contained in a system report. The system report refers to the returned message which indicates whether the system has successfully processed the alarm message. A return code is represented by a 32-bit decimal positive integer. The value 0 indicates that the system process is successful. Other return codes are defined by the NE applications. 5.3.14 Function: GetAlmResultCause Returns the information about the return codes of an alarm message. The remarks of a return code is contained in a system report. The system report refers to the returned message which indicates whether the system has successfully processed the alarm message. If the command is successfully run, the remark shows success. If a command is not successfully run, the remark gives the cause. This helps you to locate the error. 5-72 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Function Description 5.3.15 Function: GetAlmTips Returns the tips of an alarm message. For some commands, you need to provide detailed explanations in the form of tips for integrity purpose. 5.3.16 Function: GetAlmFlowNumber Returns the alarm flow number of the specified alarm in an alarm message. Alarm flow numbers are serial numbers sequenced by the alarm generation time. 5.3.17 Function: GetAlmType Returns 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 Returns the severity of the specified alarm. Alarm severity is used for identifying the impact of the fault on the service. Alarms has four severity levels: critical, major, minor, and warning. 5.3.19 Function: GetAlmNEType Returns 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 Returns 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 Returns the alarm type of the specified alarm. The following alarm types are available: power system, environment system, signaling system, relay system, hardware system, software system, running system, Qos, handling error, and internal NM system. 5.3.22 Function: GetAlmSyncSerialNo Returns 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 Returns the alarm name of the specified alarm. An alarm name briefly describes an alarm. 5.3.24 Function: GetAlmRaiseTime Returns the generation time of the specified alarm in an alarm in an alarm message. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-73 M2000 iSStar User Guide 5 HFC Library Reference Function Description 5.3.25 Function: GetAlmLocationInfo Returns the alarm location information of the specified alarm in an alarm message. The alarm location information uniquely identifies the object that generates the alarm. 5.3.26 Function: GetAlmAttrValueByName Returns the attribute value of the specified attribute of the specified alarm in an alarm message. 5.3.27 Function: GetAlmAttrValueByIdx Returns the value of specified attribute of the specified alarm in an alarm message. 5.3.28 Function: GetAlmNumByLevel Returns the number of alarms of the specified severity. 5.3.29 Function: GetAlmNumByTimeDur Returns the number of alarms in a specified period. 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 The procedure is as follows: 1. Obtain the alarm message. You can obtain the message by calling 5.1.12 Function: GetMMLReport or by manually entering the alarm message. Note that you must conform to the format specifications to enter alarm messages. Otherwise, the alarm message parsing functions fail to parse the messages. For details of alarm message format, refer to 5.3.2 Alarm Message Format. 5-74 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 2. Parse the MML message by calling 5.3.3 Function: ParseAlmRpt. 3. Obtain the required data from the parsed message. 5.3.30 Examples of Alarm Message Parsing Function shows the examples. 5.3.2 Alarm Message Format This describes the structure, components, and format of an alarm message. An alarm message is an MML message that contains alarm information. It is composed of a head, a body, and an end identifier. l 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. l A body is the main part of the alarm message. It contains all the information to be transmitted in the message. l An end identifier represents the end of the alarm message. It is used together with the start identifier to identify an alarm message. l 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. l 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-75 M2000 iSStar User Guide 5 HFC Library Reference Table 5-5 Description of the Alarm Message Format SN Field Meaning Description (1) Start identifier An alarm message starts with “ +++ ”. (2) Source identity (equipment identification) A source identity is used for identifying the physical area where an alarm is generated. It can be obtained through 5.3.4 Function: GetAlmSource. (3) Creation time The YYYY-MM-DD HH:MM:SS format is applied. It can be obtained through 5.3.6 Function: GetAlmRptTime. (4) Service message flag The service message flag is ALARM. It can be obtained through 5.3.10 Function: GetAlmServiceFlag. (5) Serial number A serial number uniquely identifies an alarm message. It can be obtained through 5.3.11 Function: GetAlmRptIdx. (6) Command echo of an MML command in an alarm message The command echo of an MML command displays the issued MML command. It can be obtained through 5.2.10 Function: GetMMLCmd. (7) Return code A return code identifies whether the NE system has successfully processed the MML commands. A return code is represented by a 32-bit decimal positive integer. The value 0 indicates that the system process is successful. Other return codes are defined by the NE applications. It can be obtained through 5.3.13 Function: GetAlmResultCode. (8) Remarks of a return code If the command is successfully run, the remark shows success. If a command is not successfully run, the remark gives the cause, which helps locate the error. It can be obtained through 5.3.14 Function: GetAlmResultCause. 5-76 (9) Service message flag of alarm 0 It can be obtained through 5.3.8 Function: GetAlmServiceTag. (10) Flow number of alarm 0 An alarm flow number identifies the sequence of the alarms generated on an NE. It can be obtained through 5.3.16 Function: GetAlmFlowNumber. (11) Alarm category of alarm 0 Alarm category is defined by the alarm nature. Alarms can be categorized into fault alarm and event alarm. It can be obtained through 5.3.17 Function: GetAlmType. (12) Alarm severity of alarm 0 Alarm severity indicates the degree of impact on the service. Four types are available: critical, major, minor, and warning. It can be obtained through 5.3.18 Function: GetAlmLevel. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference SN Field Meaning Description (13) NE type of alarm 0 NE type indicates the type of the NE where an alarm is generated. It can be obtained through 5.3.19 Function: GetAlmNEType. (14) Alarm ID of alarm 0 Alarm ID is used for identifying alarms of the same type. For the same product, the alarm ID is unique for one type of alarms. It can be obtained through 5.3.20 Function: GetAlmID. (15) Alarm type of alarm 0 Alarm type is used for identifying the source of an alarm, such as: l Power system l Environment system l Signaling system l Relay system l Hardware system l Software system l Running system l Communications system l QoS l Handling error l Internal NM system It can be obtained through 5.3.21 Function: GetAlmSort. (16) Basic attributes of an alarm The basic attributes include service message identity, flow number, alarm type, alarm severity, NE type, alarm ID, and alarm type. (17) Attribute name An alarm message contains the following items: alarm synchronization number, alarm name, alarm generation time, and location information. Some alarm messages also contain detailed description, alarm cause, handling suggestions, restoration type, and restoration time. (18) Attribute value It can be obtained through 5.3.26 Function: GetAlmAttrValueByName and 5.3.27 Function: GetAlmAttrValueByIdx. (19) Alarm synchronization No. Alarm synchronization No. is used during the process of the NM synchronizes alarms with the NE. Each alarm has one and only one alarm synchronization number. It can be obtained through 5.3.22 Function: GetAlmSyncSerialNo. (20) Alarm name An alarm name briefly describes an alarm. Its length cannot exceed 100 English characters. It can be obtained through 5.3.23 Function: GetAlmName. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-77 M2000 iSStar User Guide 5 HFC Library Reference SN Field Meaning Description (21) Alarm generation time Alarm generation time refers to the time when an alarm is generated on a device. The format is YYYY-MM-DD HH:MM:SS. It can be obtained through 5.3.24 Function: GetAlmRaiseTime. (22) Alarm location information Alarm location information uniquely identifies the object of an alarm. It can be obtained through 5.3.25 Function: GetAlmLocationInfo. Location information is composed of multiple sub-items which are separated by , , that is, an English comma and an English space. The format if each item is Item=Item value. l Item describes the location field, for example, subrack No., and board No. It is composed of Chinese characters, English letters, numbers, or English underscores. l Item value describes the location field value. It is composed of Chinese characters, English letters, or numbers. (23) Entry 0 Alarm 0 You can obtain the number of entries in an alarm message by calling 5.3.7 Function: GetAlmRptNum. (24) Entry 1 Alarm 1 (25) Entry 2 Alarm 2 (26) End identifier An alarm message ends with “ --- END ”. (27) Alarm message You can create a message parsing object by calling 5.3.3 Function: ParseAlmRpt. CAUTION The indexes of entries, attributes, and records of an alarm message count from 0. 5.3.3 Function: ParseAlmRpt 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. Synopsis ParseAlmRpt(AlmRpt) 5-78 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 AlmRpt is a string. It indicates the alarm message to be resolved. The AlmRpt string can be obtained through reading the alarm files or calling 5.1.12 Function: GetMMLReport. 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 (2008–12–08) END Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-79 M2000 iSStar User Guide 5 HFC Library Reference #Create a flag for the alarm message parsing object. p = ParseAlmRpt(strAlarm) Print("ParseAlmRpt(strAlarm) return: " + str(p)) Result ParseAlmRpt(strAlarm) return: <AlarmParser.AlarmParser instance at 0x0A4BB508> Related Example 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. Synopsis GetAlmSource(pAlmRpt) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the source identifier of the alarm message. Print('Alarm source is: ' + GetAlmSource(p) ) Result Alarm source is:NE Related Example 5.3.5 Function: GetAlmRptDate This describes the GetAlmRptDate function. This function enables you to get the create date of an alarm report. Synopsis GetAlmRptDate(pAlmRpt) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-81 M2000 iSStar User Guide 5 HFC Library Reference 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the creation date of the alarm message. Print('The create date of an alarm report is: ' + GetAlmRptDate(p) ) Result The create date of an alarm report is: 2006-01-04 Related Example 5.3.6 Function: GetAlmRptTime This describes the GetAlmRptTime function. This function enables you to obtain the generation time of an alarm message. Synopsis GetAlmRptTime(pAlmRpt) Note None. 5-82 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the creation time of the alarm message. Print('The generation time of an alarm message is: ' + GetAlmRptTime(p) ) Result The generation time of an alarm message is: 11:35:56 Related Example Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-83 M2000 iSStar User Guide 5 HFC Library Reference 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. Synopsis GetAlmRptNum(pAlmRpt) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference (Number of results = 3) --""" END #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the number of alarms in the alarm message. rptNum = GetAlmRptNum(p) Print('The number of alarm reports is: ' + str(rptNum) ) Result The number of alarm reports is: 3 Related Example 5.3.8 Function: GetAlmServiceTag This describes the GetAlmServiceTag function. This function enables you to obtain the service message flag of the specified alarm. Synopsis GetAlmServiceTag(pAlmRpt, Index) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-85 M2000 iSStar User Guide 5 HFC Library Reference +++ 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the service message flag of alarm 0. Print('The alarm service of the specified alarm is: ' + GetAlmServiceTag(p, 0) ) Result The alarm service of the specified alarm is: ALARM Related Example 5.3.9 Function: GetAlmTimeAdjustFlag This describes the GetAlmTimeAdjustFlag function. This function enables you to obtain the time adjustment flag of an alarm message. Synopsis GetAlmTimeAdjustFlag(pAlmRpt) Note None Parameter Description Parameter pAlmRpt 5-86 Description pAlmRpt indicates the parsing object of the alarm message. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 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. Synopsis GetAlmServiceFlag(pAlmRpt) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 (2008–12–08) Major RNC 110134 WGRU Board Not in Position 2005-12-27 15:06:50 Subrack No.=3, Slot No.=8 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware 5-87 M2000 iSStar User Guide 5 HFC Library Reference 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 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. Synopsis GetAlmRptIdx(pAlmRpt) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 #Get the alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the serial number of the alarm message. fl = GetAlmRptIdx(p) Print('The index of the alarm report is: ' + fl) Result The index of the alarm report is: 27232 Related Example 5.3.12 Function: GetAlmMMLCmd This describes the GetAlmMMLCmd function. This function enables you to obtain the MML command output of an alarm message. Synopsis GetAlmMMLCmd(pAlmRpt) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-89 M2000 iSStar User Guide 5 HFC Library Reference 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 #Get the alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the MML command echo of the alarm message. fl = GetAlmMMLCmd(p) Print('GetAlmMMLCmd(p) return: ' + fl) 5-90 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result GetAlmMMLCmd(p) return: LST ALMAF: CNT=0; Related Example 5.3.13 Function: GetAlmResultCode This describes GetAlmResultCode function. This function enables you to obtain the return codes. Synopsis GetAlmResultCode(pAlmRpt) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 (2008–12–08) 68046 Fault Major RNC Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 1802 Hardware Signaling 5-91 M2000 iSStar User Guide 5 HFC Library Reference Sync serial No. Alarm name Alarm raised time Location info = = = = 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 #Get the alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the return code of the alarm message. fl = GetAlmResultCode(p) The return code of an alarm message is: ' + fl) Result The return code of an alarm message is: 0 Related Example 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. Synopsis GetAlmResultCause(pAlmRpt) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 #Get the alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the remarks of the return code of the alarm message. fl = GetAlmResultCause(p) Print('The information about the return code of an alarm message is: ' + fl) Result The information about the return code of an alarm message is: Execution succeeded. Related Example 5.3.15 Function: GetAlmTips This describes the GetAlmTips function. This function enables you to get the tips of an alarm message. Synopsis GetAlmTips(pAlmRpt) Note None Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-93 M2000 iSStar User Guide 5 HFC Library Reference 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 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. Synopsis GetAlmFlowNumber(pAlmRpt,Index) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the alarms in the alarm message. The index starts from 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.3.17 Function: GetAlmType This describes the GetAlmType function. This function enables you to obtain the alarm category of the specified alarm. Alarm category is defined by alarm nature. Alarms can be categorized into fault alarm and event alarm. Synopsis GetAlmType(pAlmRpt, Index) Note None Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-95 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result The alarm type of the specified alarm is: Fault Related Example 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. Synopsis GetAlmLevel(pAlmRpt,Index) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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 (2008–12–08) Major RNC 110134 WGRU Board Not in Position 2005-12-27 15:06:50 Subrack No.=3, Slot No.=8 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware 5-97 M2000 iSStar User Guide 5 HFC Library Reference 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 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. Synopsis GetAlmNEType(pAlmRpt,Index) Note None Parameter Description 5-98 Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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.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. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-99 M2000 iSStar User Guide 5 HFC Library Reference Synopsis GetAlmID(pAlmRpt,Index) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference --""" 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 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. Synopsis GetAlmSort(pAlmRpt,Index) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-101 M2000 iSStar User Guide 5 HFC Library Reference 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) #Get the alarm type of alarm 0. Print('The alarm sort of the specified alarm is: ' + sort) Result The alarm sort of the specified alarm is: Hardware Related Example 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. Synopsis GetAlmSyncSerialNo(pAlmRpt,Index) Note None 5-102 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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) #Get the alarm synchronization number of alarm 1. Print("The alarm's sync serial No. of the 1st alarm is: " + serial) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-103 M2000 iSStar User Guide 5 HFC Library Reference Result The alarm's sync serial No. of the 1st alarm is: 110145 Related Example 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. Synopsis GetAlmName(pAlmRpt,Index) Note An alarm name can contain a maximum of 1000 English characters. Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 # Get the alarm message parsing object. p = ParseAlmRpt(strAlarm) # Get the alarm name of alarm 2. almName = GetAlmName(p, 2) Print('The alarm name of the 2th alarm is: ' + almName) Result The alarm name of the 2th alarm is: SAAL Link Unavailable Related Example 5.3.24 Function: GetAlmRaiseTime This describes the GetAlmRaiseTime function. This function enables you to obtain the generation time of the specified alarm. Synopsis GetAlmRaiseTime(pAlmRpt,Index) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-105 M2000 iSStar User Guide 5 HFC Library Reference 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the generation time of alarm 0. rtime = GetAlmRaiseTime(p, 0) Print('The raising time of the Index alarm is: ' + rtime) Result The raising time of the Index alarm is: 2005-12-27 15:06:50 Related Example 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-106 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. 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 (2008–12–08) RNC Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 1802 Hardware Signaling 5-107 M2000 iSStar User Guide 5 HFC Library Reference Alarm name Alarm raised time Location info = = = 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the alarm location information of alarm 0. locInfo = GetAlmLocationInfo(p, 0) 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 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. Synopsis GetAlmAttrValueByName(pAlmRpt, Index, PropName, Case = 0)) Note None Parameter Description 5-108 Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the entries in an alarm message. The index counts from 0. The index starts from 0. The Nth entry of the alarm message refers to the Nth alarm. PropName PropName is a string. It indicates the attribute name of the entries in the alarm message. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Case Case is an integer. By default, the value of Case is 0. l For English alarm messages, if the value of Case is 0, you can infer that the strings to be compared are case sensitive during comparison. If the value of Case is not 0, you can infer that the strings to be compared are case insensitive. l For Chinese alarm messages, the strings to be compared are not case sensitive. 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the attribute value of the alarm named “Sync serial No.” in alarm 0. propvalue = GetAlmAttrValueByName(p, 0, "Sync serial No.") Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-109 M2000 iSStar User Guide 5 HFC Library Reference 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 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. Synopsis GetAlmAttrValueByIdx(pAlmRpt,Index,PropIndex) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Index Index is an integer. It indicates the index of the alarms in the alarm message. The index starts from 0. PropIndex PropIndex is an integer. It indicates the index of the entry attributes in the alarm report. The index starts from 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Sync serial No. Alarm name Alarm raised time Location info = = = = 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 #Create an alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the attribute value of attrtibute 2 in alarm 1. propvalue = GetAlmAttrValueByIdx(p, 0, 2) 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 5.3.28 Function: GetAlmNumByLevel This describes the GetAlmNumByLevel function. This function enables you to obtain the number of alarms of the specified severity. Synopsis GetAlmNumByLevel(pAlmRpt, Level, Case = 0) Note None Parameter Description Parameter Description pAlmRpt pAlmRpt indicates a parsed alarm message object. Level Level is a string. It indicates the alarm severity. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-111 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Case Case is an integer. By default, the value of Case is 0. l For English alarm messages, if the value of Case is 0, you can infer that the strings to be compared are case sensitive during comparison. If the value of Case is not 0, you can infer that the strings to be compared are case insensitive. l For Chinese alarm messages, the strings to be compared are not case sensitive. 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 #Get the alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the number of "major" alarms. num = GetAlmNumByLevel(p, "Major") 5-112 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Print('The number of alarms of the specified severity(major) is: ' + str(num) ) Result The number of alarms of the specified severity(major) is: 3 Related Example 5.3.29 Function: GetAlmNumByTimeDur This describes the GetAlmNumByTimeDur function. This function enables you to obtain the number of alarms in a specified period. 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 pAlmRpt indicates a parsed alarm message object. Start Start is a string. It indicates the start time. The valid range is from 2000-01-01 00:00:00 to 2037-12-31 23:59:59. Stop Stop is a string. It indicates the end time. The valid range is from 2000-01-01 00:00:00 to 2037-12-31 23:59:59. Return Value The return value is a string. If the function is called successfully, the number of alarms in the specified period is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example strAlarm = """ +++ NE 2006-01-04 11:35:56 ALARM #27232 %%LST ALMAF: CNT=0;%% RETCODE = 0 Execution succeeded. ALARM Issue 01 (2008–12–08) 67984 Fault Major RNC Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware 5-113 M2000 iSStar User Guide 5 HFC Library Reference Sync serial No. Alarm name Alarm raised time Location info = = = = 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 #Get the alarm message parsing object. p = ParseAlmRpt(strAlarm) #Get the number of alarms generated between “2005-12-27 15:06:50” and “2005-12-27 15:06:59”. num = GetAlmNumByTimeDur(p, "2005-12-27 15:06:50", "2005-12-27 15:06:59") Print('The number of alarms in a specified period is: ' + str(num) ) Result The number of alarms in a specified period is: 1 Related Example 5.3.30 Examples of Alarm Message Parsing Function This gives examples of the alarm message parsing function. You can better understand how to use NE operation functions to perform routine maintenance. Example 1 of MML Message Parsing Function def showAlmInfoByIndex(strAlarm, index) if index < 0 Print("The index is invalid") return end almParser = ParseAlmRpt(strAlarm) if GetAlmRptNum(almParser) <= 0 Print("No alarm exists") else flowNumber = GetAlmFlowNumber(almParser, index) Print('The flownumber of alarm No '+str(index)+': ' + flowNumber) alarmtype = GetAlmType(almParser, index) Print('The alarm type of alarm No '+str(index)+': ' + alarmtype) almLevel = GetAlmLevel(almParser, index) Print('The alarm level of alarm No '+str(index)+': ' + almLevel) netype = GetAlmNEType(almParser, index) Print('The type of the NE of alarm No '+str(index)+': ' + netype) end end 5-114 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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) --END """ showAlmInfoByIndex(strAlarm, 0) Result The The The The flownumber of alarm No 0: 67984 alarm type of alarm No 0: Fault alarm level of alarm No 0: Major type of the NE of alarm No 0: RNC Example 2 of MML Message Parsing Function def getAlmTypeByTime(strAlarm, time) almParser = ParseAlmRpt(strAlarm) numAlm = GetAlmRptNum(almParser) if(numAlm < 0) return "No alarm exists" else for item in range(numAlm) if(time == GetAlmRaiseTime(almParser, item)) return GetAlmLevel(almParser, item) end end end return "No alarm exists" end 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 (2008–12–08) Major RNC 110134 WGRU Board Not in Position 2005-12-27 15:06:50 Subrack No.=3, Slot No.=8 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 211 Hardware 5-115 M2000 iSStar User Guide 5 HFC Library Reference 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 ret = getAlmTypeByTime(strAlarm, "2005-12-27 15:07:27") Print("An %s alarm happended at 2005-12-27 15:07:27 ."%ret) Result An Major alarm happended at 2005-12-27 15:07:27 . 5.4 Database Operation Function The database operation module provides the query operation interface for alarms, performances, and the configuration library. 5.4.1 Overview of Database Operation Functions This describes the basic functions and procedures of database operation functions. 5.4.2 Function: OpenDB This describes how to set up connections between existing tasks and the data center database. 5.4.3 Function: CreateCond This describes the CreateCond(ENUM) function, which enables you to create objects of query conditions, which facilitates the setting of items in the query conditions. 5.4.4 Function: QueryFmRcds This describes the QueryFmRcds function, which enables you to query the alarms that meet the specified conditions. The results are sorted in the specified mode by the specified field. 5.4.5 Function: NextFmRcds This describes the QueryFmRcds function. This function enables you to obtain the alarm data queried by the QueryFmRcds function. 5.4.6 Function: QueryPmRcds This describes the QueryPmRcds function, which enables you to query performance data records. 5.4.7 Function: NextPmRcds This describes the NextPmRcds() function, which enables you to obtain the queried performance data through QueryFmRcds(). 5.4.8 Function: QueryCmRcds 5-116 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-117 M2000 iSStar User Guide 5 HFC Library Reference 5.4.23 Function: GetMocAttrNameList The GetMocAttrNameList function is used to query MOC attribute names based on MOC names and NE FDNs. 5.4.24 Function: GetMocList The GetMocList function is used to query the MOC name of an NE based on the FDN of the NE. 5.4.25 Function: GetNeObjInfo The GetNeObjInfo function is used to obtain the information about the NE performance measurement objects of a certain type based on the function set ID and FDN of an NE. 5.4.26 Function: GetCounterInfo The GetCounterInfo function is used to obtain the information about performance counters based on the function subset IDs and measurement periods of NEs. 5.4.27 Function: GetFuncSetList The GetFuncSetList function is used to obtain the information about NE function sets based on NE types. 5.4.28 Function: GetFuncSubSetList The GetFuncSubSetList function is used to obtain the information about NE function subsets based on the IDs of NE function sets. 5.4.29 Function: GetMoiAttrValueList The GetMoiAttrValueList function is used to obtain MOI attribute values based on the MOI information and the list of attribute names. 5.4.30 Function: GetMoiListByFilter The GetMoiListByFilter function is used to query the MOIs of an MOC based on the MOC name, NE FDN, and filtering conditions. 5.4.31 Function: GetPmNeType The GetPmNeType function is used to obtain the information about NE types, including the names and IDs of NE types. 5.4.32 Function: GetNeInfo The GetNeInfo function is used to obtain the NE information based on the NE FDN, such as the NE name and type ID. 5.4.33 Function: CloseDB This describes the CloseDB function, which enables you to close the connection with the database center. 5.4.1 Overview of Database Operation Functions This describes the basic functions and procedures of database operation functions. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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.2 Function: OpenDB Establishes a connection with the M2000 data center. 5.4.3 Function: CreateCond Create objects of query condition. 5.4.4 Function: QueryFmRcds Returns the alarms that meet the conditions. 5.4.5 Function: NextFmRcds Returns the queried alarm data. 5.4.6 Function: QueryPmRcds Returns the performance data that meets the conditions. 5.4.7 Function: NextPmRcds Returns the queried performance data. 5.4.8 Function: QueryCmRcds Returns the configuration data that meets the conditions. 5.4.9 Function: NextCmRcds Returns the queried configuration data. 5.4.10 Function: GetCmCom Returns the MO data that meets the conditions in the configuration database. 5.4.11 Function: GetChildMoc Returns child MOC data of the specified NEs in the configuration database. 5.4.33 Function: CloseDB Closes the connection with the M2000 data center. 5.4.12 Function: GetIntegrityReportCond Obtains integrity query conditions. 5.4.13 Function: GetFunctionSubSetList Obtains the list of function subsets, including their IDs and names. 5.4.14 Function: QueryIntegrityResult Queries an integrity result based on the integrity query conditions. 5.4.15 Function: GetOneNEInteLst Obtains the integrity result of a specified NE from the integrity query results. 5.4.16 Function: GetOneFssInte Obtains the integrity report of a specified function subset from an NE integrity report. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-119 M2000 iSStar User Guide 5 HFC Library Reference Function Description 5.4.17 Function: GetOneIntegrity Obtains the integrity result of a specified NE or a function subset from an integrity report. 5.4.18 Function: GetPmCond Create performance query conditions that contain only default values. 5.4.19 Function: GetFmCond Create an alarm query condition that contains only default values. 5.4.20 Function: QueryRecord Query the performance data or alarm data that meets the query conditions. 5.4.21 Function: RecordCount Obtain the records returned by the QueryRecord function. 5.4.22 Function: NextRecord Obtain the records obtained by the QueryRecord function. 5.4.23 Function: GetMocAttrNameList Query MOC attribute names based on MOC names and NE FDNs. 5.4.24 Function: GetMocList Query the MOC name of an NE based on the FDN of the NE. 5.4.25 Function: GetNeObjInfo Obtain the information about the NE performance measurement objects of a certain type based on the function set ID and FDN of an NE. 5.4.26 Function: GetCounterInfo Obtain the information about performance counters based on the function subset IDs and measurement periods of NEs. 5.4.27 Function: GetFuncSetList Obtain the information about NE function sets based on NE types. 5.4.28 Function: GetFuncSubSetList Obtain the information about NE function subsets based on the IDs of NE function sets. 5.4.29 Function: GetMoiAttrValueList Obtain MOI attribute values based on the MOI information and the list of attribute names. 5.4.30 Function: GetMoiListByFilter Query the MOIs of an MOC based on the MOC name, NE FDN, and filtering conditions. 5.4.31 Function: GetPmNeType Obtain the information about NE types, including the names and IDs of NE types. 5.4.32 Function: GetNeInfo Oobtain the NE information based on the NE FDN, such as the NE name and type ID. Procedure Figure 5-7 shows how to use the database operation functions. 5-120 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Figure 5-7 Procedure for using database operation functions The procedure shown in Figure 5-7 is as follows: 1. Establish the connection with the database. Use 5.4.2 Function: OpenDB to establish the connection with the database in the data center. 2. Create database query conditions. Use 5.4.3 Function: CreateCond to create objects of query conditions. 3. Perform database queries. Based on the actual requirements, use the database operation functions such as 5.4.4 Function: QueryFmRcds, 5.4.6 Function: QueryPmRcds, or 5.4.8 Function: QueryCmRcds to query alarms, performance, or configuration data and then obtain the execution result. 4. Process the returned results. You can process the returned results, such as make statistical analysis and generate reports. 5. Close the connection with the database. After all the database operations are complete, use 5.4.33 Function: CloseDB to close the connection with the database in the data center. 5.4.2 Function: OpenDB This describes how to set up connections between existing tasks and the data center database. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-121 M2000 iSStar User Guide 5 HFC Library Reference Synopsis OpenDB(UserName, Password) Note None Parameter Description Parameter Description UserName UserName is a string. It is an optional argument indicating the name of the user. Password Password is a string. It is an optional argument indicating the user password. NOTE l If the user name and password are not entered, the database is accessed through the current client login user and password. l If the user name and password are entered, the database is accessed through the entered user name and password. l To invoke the OpenDB interface, you must enter both the user name and password, or enter neither of them. Return Value The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example #Connect the database. returncode = OpenDB("admin", "11111111") Print('OpenDB() return: ' + str(returncode)) #Close the database connection. CloseDB() Result OpenDB() return: 1 5.4.3 Function: CreateCond This describes the CreateCond(ENUM) function, which enables you to create objects of query conditions, which facilitates the setting of items in the query conditions. 5-122 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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, #alarm query condition ID PM_COND, #performance query condition ID CM_COND #configuration query condition ID }. Return Value If this function is called successfully, the objects of query conditions are returned. Otherwise, None is returned. Error Handling None Example #Connect the database. OpenDB("admin", "11111111") #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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-123 M2000 iSStar User Guide 5 HFC Library Reference 5.4.4 Function: QueryFmRcds This describes the QueryFmRcds function, which enables you to query the alarms that meet the specified conditions. The results are sorted in the specified mode by the specified field. Synopsis QueryFmRcds(Fmcond) Note l QueryFmRcds(Fmcond) enables you to query the alarms that meet the specified conditions. The results are sorted in the specified mode by the specified field. You can get the queried results by calling the function NextFmRcds. l Call the function OpenDB to connect to the database before calling this function. Parameter Description Parameter 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. Table 5-7 Description of items in Fmcond Enumerated Type 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 1: sort by serial number l 2: sort by NEFDN Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Enumerated Type Detailed Information l 3: sort by alarm time l 4: sort by alarm severity l 5: sort by alarm causes l l 6: sort by acknowledge status 9: sort by NEType l 10: sort by FDN l l 16: sort by device flow number 17: sort by alarm ID l 18: sort by clearance time 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 Alarm type. You can set the item by using Fmcond [ALARM_CATE]. Fmcond [ALARM_CATE] is an integer with the default value as 1. The values and meanings are as follows: l 1: current fault alarm l 2: event alarm l 3: history fault alarm Time mode. You can set the item by using Fmcond [TIME_MODE]. Fmcond [TIME_MODE] is an integer. The values and meanings are as follows: l 0: server time mode l 1: NE time mode NOTE If you do not set Fmcond [TIME_MODE], the default value is 1. START_TIME Issue 01 (2008–12–08) Start time. You can set the item by using Fmcond Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-125 M2000 iSStar User Guide 5 HFC Library Reference 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. You can set the item by using Fmcond [END_TIME]. Fmcond [END_TIME] is a tuple indicating the end time of the alarm query. The time composes year, month, day, hour, minute, and second. The default value indicates querying all alarms generated after Fmcond [START_TIME]. END_TIME NOTE If neither the start time nor the end time is set, all the alarm data is queried. ALARMINFO_SEQ 5-126 Sequence of alarm records. You can set the item by using Fmcond [ALARMINFO_SEQ]. Fmcond [ALARMINFO_SEQ] indicates the information of queried alarms. The value is a list containing unlimited elements (null is allowed). Alms = [listalm, listalm1,..]. The elements in the list are tuples with each containing three elements, that is, listalm = (ProductId, NeTypeId, AlarmId). ProductId: integer type. It indicates the type of the product that generates the Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 l 5: intelligent l 6: network management NTTypeID: is an integer. It indicates the NE type of the alarm. The values and meanings are as follows: l 100000: OMC l 1: RNC l 2: NodeB l 3: SGSN l 4: GGSN l 5: CG l 6: SoftX l 7: MGW l 8: HLR AlarmId: is an integer. If alarm ID, ProductID, and NEType are specific, an alarm can be uniquely identified. The value of AlarmId can be any integer including negative integers, except -1. NEFDN_SEQ Issue 01 (2008–12–08) Sequence of NE Fdns. You can set the item by using Fmcond[FDN_SEQ]. The value is a list containing unlimited elements, that is, [Fdn, Fdn1,...]. Set the length of the sequence to 0 unless otherwise specified. Fdn is a string. It is the FDN of an NE and uniquely identifies an NE. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-127 M2000 iSStar User Guide 5 HFC Library Reference 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 l 3: signaling system l 4: relay system l 5: hardware system l 6: software system l 7: running system l 8: communications system l 9: QoS l 10: handling error l 11: internal NM system Sequence of alarm severities. You can set the item by using Fmcond [ALARMLEVEL_SEQ]. The value is a list containing unlimited elements indicating alarm severity. Set the length of the sequence to 0 unless otherwise specified. The values and meanings are as follows: l 1: critical l 2: major l 3: minor l 4: warning Sequence of alarm status. You can set the item by using Fmcond [ALARMSTATUS_SEQ]. The value is a list containing unlimited elements Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 (2008–12–08) 6: unacknowledged Sequence of link FDNs. You can set the item by using Fmcond[LINKFDN_SEQ]. The value is a list containing string type elements indicating link FDN. FDN uniquely identifies a link. The list contains unlimited elements. Set the length of the sequence to 0 unless otherwise specified. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-129 M2000 iSStar User Guide 5 HFC Library Reference 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 l 0: note l 1: intermittent fault l 2: high frequency intermittent fault For event alarms, the values and meanings are as follows: l 0: note l 3: repetitive event l 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 5.4.5 Function: NextFmRcds This describes the QueryFmRcds function. This function enables you to obtain the alarm data queried by the QueryFmRcds function. 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 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 Refers to an alarm category. The parameter value is an integer. The specific values and meanings are as follows: l 1: Current Fault Alarms l 2: Event Alarms l 3: History Fault Alarms DevFdn Refers to the FDN of a device, which is the only identifier of the device that generates alarms. The parameter value is a string. NE Refers to NE information, which is a custom data type and contains the following three fields: ProductID, NEType, and NEFdn. DevCsn Refers to the serial number (SN) of a device. The parameter value is an integer. Id Refers to the ID of an alarm. The parameter value if an integer. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-131 M2000 iSStar User Guide 5 HFC Library Reference Attribute Description Type Refers to the type of a cause that generates alarms. The parameter value is an integer. The specific values and meanings are as follows: Level Restore Confirm Operator 5-132 l 1: Power system l 2: Environment system l 3: Signaling system l 4: Relay system l 5: Hardware system l 6: Software system l 7: Running system l 8: Communications system l 9: QoS l 10: Handling error l 11: Internal NM system Refers to an alarm severity. The parameter value is an integer. The specific values and meanings are as follows: l 1: Critical l 2: Major l 3: Minor l 4: Warning Refers to the cleared state of an alarm, which identifies whether an alarm is cleared. The parameter value is an integer. The specific values and meanings are as follows: l 0: Uncleared l 1: Cleared Refers to the acknowledgement state of an alarm, which identifies whether an alarm is acknowledged. The parameter value is an integer. The specific values and meanings are as follows: l 0: Unacknowledged l 1: Acknowledged Refers to the user name of the operator who acknowledges the alarm. The parameter value is a string. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Attribute Description Paras Refers to the sequence of an alarm parameter. The parameter value is a list whose length is 10. This parameter represents the additional information to alarm data. ExtendInfo Refers to the additional information about an alarm. The parameter value is a string. LinkObjId Refers to the ID of a link object. The parameter is a string. LinkType Refers to the link type of an alarm. The parameter value is an integer. The specific values and meanings are as follows: l -1: indicates that the alarm is a link alarm. l An integer that is greater than 0: indicates that the alarm is a link alarm. ReasonId Currently, ReasonId is not used and conveys no meaning. ClearOperator Refers to the user name of the operator who clears an alarm. The parameter value is a string. Csn Refers to the SN of a network. The parameter value is an integer. dtRaise Refers to the generation time of an alarm. This is a custom object. The elements and meanings are as follows: l dt: Time. l timezoneOffset: refers to the offset of a time zone. l dstTimeOffset: refers to the time offset of daylight saving time. The element dt is also an object type and its elements and their meanings are as follows: Issue 01 (2008–12–08) l year l month l day l hour l minute l second Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-133 M2000 iSStar User Guide 5 HFC Library Reference Attribute Description dtAck Refers to the acknowledgement time of an alarm. This is a custom object. The elements and meanings are as follows: l dt: Time. l timezoneOffset: refers to the offset of a time zone. l dstTimeOffset: refers to the time offset of daylight saving time. The element dt is also an object type and its elements and their meanings are as follows: dtClear l year l month l day l hour l minute l second Refers to the clearance time of an alarm. This is a custom object. The elements and meanings are as follows: l dt: Time. l timezoneOffset: refers to the offset of a time zone. l dstTimeOffset: refers to the time offset of daylight saving time. The element dt is also an object type and its elements and their meanings are as follows: l year l month l day l hour l minute l second Error Handling If errors occur, you can obtain the error information by referring to Function: GetLastError and Function: GetErrorMsg. Example ################################################# 5-134 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference # # parse one record of the alarm data# # Input:record # # ################################################# def detail(record) Print('Category:' + str(record.Category)) Print('DevFdn: ' + str(record.DevFdn)) Print('NE: (' + str(record.NE.ProctID) + ', ' + str(record.NE.NEType) + ', ' + str(record.NE.ob Print('DevCsn: ' + str(record.DevCsn)) Print('CSN: ' + str(record.Csn)) Print('Id: ' + str(record.Id)) Print('Type: ' + str(record.Type)) Print('Level: ' + str(record.Level)) Print('Restore: ' + str(record.Restore)) Print('Confirm: ' + str(record.Confirm)) Print('Operator: ' + str(record.Operator)) i = [] for p in record.Paras i.append(p) end Print('Paras: ' + str(i)) Print('ExtendInfo: ' + str(record.ExtendInfo)) Print('LinkObjId: ' + str(record.LinkObjId)) Print('LinkType: ' + str(record.LinkType)) Print('ReasonId: ' + str(record.ReasonId)) Print('ClearOperator: ' + str(record.ClearOperator)) Print('Raise Time: (' + str(record.dtRaise.dt.year) + ', ' \ + str(record.dtRaise.dt.month) + ', ' + str(record.dtRaise.dt.day) + ',' \ + str(record.dtRaise.dt.hour) + ', ' + str(record.dtRaise.dt.minute) + ',' \ + str(record.dtRaise.dt.second) + '; ' + str(record.dtRaise.timezoneOffset) + ',' \ + str(record.dtRaise.dstTimeOffset) + ')') Print('Acknowledge Time: (' + str(record.dtAck.dt.year)+', ' \ + str(record.dtAck.dt.month) + ', ' + str(record.dtAck.dt.day) + ',' \ + str(record.dtAck.dt.hour) + ', ' + str(record.dtAck.dt.minute) + ',' \ + str(record.dtAck.dt.second) + '; ' + str(record.dtAck.timezoneOffset) + ',' \ + str(record.dtAck.dstTimeOffset) + ')') Print('Clear Time: (' + str(record.dtClear.dt.year)+', ' \ + str(record.dtClear.dt.month) + ', ' + str(record.dtClear.dt.day) + ',' \ + str(record.dtClear.dt.hour) + ', ' + str(record.dtClear.dt.minute) + ',' \ + str(record.dtClear.dt.second) + '; ' + str(record.dtClear.timezoneOffset) + ',' \ + str(record.dtClear.dstTimeOffset) + ')') end #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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-135 M2000 iSStar User Guide 5 HFC Library Reference fmcond[ALARMLEVEL_SEQ] = [2] #Query the alarms that meet the condition and output the number of alarm records. returncode = QueryFmRcds(fmcond) Print('QueryFmRcds() return: ' + str(returncode)) #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) ... 5.4.6 Function: QueryPmRcds This describes the QueryPmRcds function, which enables you to query performance data records. Synopsis QueryPmRcds(Pmcond) Note 5-136 l QueryPmRcds(Pmcond) enables you to query performance data records. You can get the performance results by calling the function NextPmRcds. l Call the functionOpenDB to connect to the database before calling this function. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. Table 5-9 Description of items of Pmcond Enumerated Type 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 l 1: M2000 l 2: LMT l 3: NodeB l 4: RNC l 5: MSCServer l 6: MGW l 7: SGSN l 8: GGSN80 l 9: HLR l 10: CG l 17: SGSN_MML FUNCTION_SUBSET Function subset. You must set it before querying the performance data. You can set it through pmcond [FUNCTION_SUBSET]. It indicates the ID of function subset which is the last part of the FDN field, that is, the part behind the last ".". TIME_MODE Time mode. It indicates the adopted time mode. You can Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-137 M2000 iSStar User Guide 5 HFC Library Reference 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 The default value is 0. Default time. You can set it through pmcond [TIME_DEFAULT]. It is used to defined the time range for querying performance data. The values and meanings are as follows: l 0: TODAY TIME_DEFAULT l 1: YESTERDAY l 2: THISWEEK l 3: LASTWEEK l 4: SPEC l 5: ALL The default value is 5, indicating querying all performance data generated at all times. Only when timedefault=SPEC, the time specified by pmcond [START_TIME] and pmcond[END_TIME] serves as query condition. In other cases, the query condition is the default value of pmcond [TIME_DEFAULT]. Period for querying results. You can set it through pmcond[PERIOD]. The values and meaning are as follows: l 0: 5 minutes PERIOD l 1: 15 minutes l 2: 30 minutes l 3: 60 minutes l 4: 1440 minutes The default value is 2, that is, the period defaults 30 minutes. 5-138 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 (2008–12–08) End time. You can set it through pmcond [END_TIME]. The values are tuples indicating the end 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 [END_TIME] are queried. In this foramt, 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 range ranges from 0 to 2. The default value is 0. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-139 M2000 iSStar User Guide 5 HFC Library Reference 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 FDN sequence of objects. You can set it through pmcond[NEFDN_SEQ]. The value is a list whose elements are of string type indicating the object FDNs. FDN uniquely identifies an NE. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 sortType: integer type. It indicates the field by which the results are sorted. The values and meanings are as follows: l 1: sort by object l 2: sort by time l 3: sort by counter counterId: long integer type. It indicates the counter ID. sortDirection: integer type. The values and meanings are as follows: l 0: not sort l 1: ascending order l 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 5.4.7 Function: NextPmRcds This describes the NextPmRcds() function, which enables you to obtain the queried performance data through QueryFmRcds(). Synopsis NextPmRcds() Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-141 M2000 iSStar User Guide 5 HFC Library Reference Note l NextPmRcds() enables you to obtain the queried performance data through 5.4.4 Function: QueryFmRcds. Each time 2000 records are returned. If the number of performance records exceeds 2000, call the function for multiple times to return all the performance data. If the number of performance records does not reach 2000, all the performance data is returned. l Call 5.4.2 Function: OpenDB to connect to the database before calling this function. Parameter Description None Return Value The return value is a 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference #Query the performance data that meets the condition. returncode = QueryPmRcds(pmcond) Print("QueryPmRcds() return: " + str(returncode)) #Get the performance data queried by the QueryPmRcds() function. PmRecords = NextPmRcds() #Close the database connection. CloseDB() Result QueryPmRcds() return:3498 5.4.8 Function: QueryCmRcds This describes the QueryCmRcds function, which enables you to get the queried configuration data records. Synopsis QueryCmRcds(Cmcond) Note l QueryCmRcds(Cmcond) enables you to get the queried configuration data records. Get the queried result by calling 5.4.9 Function: NextCmRcds. l Before calling this function, call 5.4.2 Function: OpenDB to connect the database. Parameter Description Parameter 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 ParentObjId: ID of parent managed object (MO). Cmcond [ParentObjId] is a long integer. You can set it through Cmcond [ParentObjId]. l NE_FDN: FDN of an NE. Cmcond[NE_FDN] is a string. You can set it through Cmcond[NE_FDN]. l CHILD_MOC: name of child manage object class (MOC). Cmcond [CHILD_MOC] is a string. You can set it through Cmcond [CHILD_MOC]. Return Value The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0 is returned. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-143 M2000 iSStar User Guide 5 HFC Library Reference Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Related Example 5.4.9 Function: NextCmRcds This describes the NextCmRcds() function, which enables you to obtain the configuration data queried through QueryCmRcds(). Synopsis NextCmRcds() Note l NextCmRcds() enables you to obtain the configuration data queried through 5.4.8 Function: QueryCmRcds. Each time 1000 records are returned. If the number of configuration records exceeds 1000, call the function for multiple times to return all the alarm data. If the number of alarm records does not reach 1000, all the configuration data is returned. l Call 5.4.2 Function: OpenDB to connect to the database before calling this function. Parameter Description None Return Value The return value is a list. If calling this function succeeds, the configuration data list is returned and the elements in the lists are of long integer type. Otherwise, an empty list is returned. Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example #Open the database connection. OpenDB("admin", "11111111") Print("") Print("----------### Query the configuration ####----------") cmcond = CreateCond(CM_COND) cmcond[PARENT_ID] = 3223011329 cmcond[NE_FDN] = '.3221229568.3221233664.3221291041' cmcond[CHILD_MOC] = 'RNCOriginSigPoint' ee = QueryCmRcds(cmcond) Print("CM result: " + str(ee) ) CMlist = NextCmRcds() while CMlist CMlist = NextCmRcds() end 5-144 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result ----------### Query the configuration ####---------CM result:2360 5.4.10 Function: GetCmCom This describes the GetCmCom(Fdn,objSeq) function, which enables you to obtain the configuration data of the specified object. Synopsis GetCmCom(Fdn,objSeq) Note l GetCmCom(Fdn,objSeq) enables you to obtain the configuration data of the specified object. Obtain the queried results through 5.4.9 Function: NextCmRcds. l Call 5.4.2 Function: OpenDB to connect to the database before calling this function. Parameter Description Parameter Description Fdn Fdn is a string. It indicates the NE FDN. If the list is empty, the return value is the configuration data of the root MO. objSeq objSeq is a list. It indicates the ID sequence of MOs. Return Value The return value is a list. If calling the function succeeds, the configuration data is returned. Otherwise, an empty list is returned. The return value of GetCmCom() is a list. The configuration data of the specified object ID is returned. The return value is: MoDataSeq = [MoData, MoData1, MoData2, ...]. MoData is of MO data type. It has the following elements: objId, mocName, displayMocName, name, and groupSeq. The meaning of each element is as follows: l objId: long integer type. It indicates the ID of the MO object in the configuration data. l MocName: character type. It indicates the name of MOC. l displayMocName: string type. It indicates the display name of MOC. l name: character type. It indicates the name of MO. l groupSeq: list type. The elements in the list are attribute groups. The list is: groupSeq = [group, group1, ...]. The element group is the attribute group which has two elements: groupName and data. The meaning of each element is as follows: Issue 01 (2008–12–08) – groupName: string type. It indicates the name of the attribute group. – 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 5 HFC Library Reference 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() 5.4.11 Function: GetChildMoc This describes the GetChildMoc function, which enables you to obtain the child MOC and the attribute list. Synopsis GetChildMoc(NEFdn, ParentMoc) Note Call 5.4.2 Function: OpenDB to connect to the database before calling this function. Parameter Description Parameter Description NEFdn NEFdn is a string. It indicates the NE FDN which uniquely identifies the configuration data. ParentMoc ParentMoc is a string. It indicates the name of the parent managed object class (MOC). Return Value The return value is a list. If the function is called successfully, the attribute list of parent MOC is returned. Otherwise, an empty list is returned. 5-146 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference NOTE The return value of GetChildMoc() is a list. The elements in the list are the types of MOC data objects. The return value can be represented by [Moc, Moc1, ...]. An MOC has three attributes: name, displayName, and attrInfoGroups. The meanings are as follows: l name: string type. It indicates the name of the MOC. l displayName: string type. It indicates displayed MOC name. l attrInfoGroups: list type. attrInfoGroups = [attrInfoGroup, attrInfoGroup1, ...], where attrInfoGroup is of attribute information group object type indicating the attribute information group of MOC. attrInfoGroup = [attrInfo, attrInfo1, ...], where attrInfo is of attribute information object type and contains three elements: name, displayName, and attrtype: l name: string type. It indicates the attribute name. l displayName: string type. It indicates the displayed attribute name. l attrtype: enumeration type. It indicates the attribute type. The value 0 indicates the integer type; 1 indicates the double type; 2 indicates the string type. Error Handling Obtain the error information by using 5.10.2 Function: GetLastError and 5.10.3 Function: GetErrorMsg. Example #Connect the database. OpenDB("admin", "11111111") retlist = GetChildMoc('.3221229568.3221233664.3221278720', 'RncEquipment') Print('GetChildMoc() return recordCount: ' + str(len(retlist))) #Close the database connection. CloseDB() 5.4.12 Function: GetIntegrityReportCond This describes the GetIntegrityReportCond function. This function enables you to obtain integrity query conditions. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-147 M2000 iSStar User Guide 5 HFC Library Reference Attribute Description neTypeName Refers to the name of an NE type. period Refers to a query period. neFDNList Refers to the list of NE FDNs, which is in the form of [FDN1, FDN2, ...]. FssIdList Refers to the list of function subset IDs, which is in the form of [Subset ID1, Subset ID2, ...]. timeMode Refers to a time mode, whose values and meanings are as follows: l 0: Server time mode l 1: NE time mode NOTE The default time mode is server time mode. startTime Refers to the start time for query. The format is (year, month, day, hour, minute, second). endTime Refers to the end time for query. The format is (year, month, day, hour, minute, second). timezoneOffset Refers to the offset of a time zone. The default value is -1. dstTimeOffset Refers to the offset of the daylight saving time. The default value is -1. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100; 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. 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 (2008–12–08) Measurement of RAB release triggered by UTRAN per cell Measurement of multi-RAB service per cell Measurement of RB Procedure per cell Soft Handover Measurement per cell Hard Handover Measurement per cell InterRAT Handover Measurement per cell Cell Update Measurement per cell URA Update Measurement per cell RRC Reporting Measurement per cell Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-149 M2000 iSStar User Guide 5 HFC Library Reference ... 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. 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 #Set querying condition cond = GetIntegrityReportCond() cond.neTypeName = 'RNC' cond.period=0 cond.neFDNList=['.3221229568.3221233664.3221282816','.3221229568.3221233664.3221282817','.32212 cond.FssIdList=[67109391,67109473,67109395,6710943] cond.timeMode=0 cond.startTime=(2008, 8, 4, 10, 0, 0) cond.endTime=(2008, 8, 4, 16, 0, 0) #query the integrity report li = QueryIntegrityResult(cond) Print("result length is: " + str(len(li))) Result result length is: 5 5-150 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. 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 Refers to the FDN of an NE. 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 (2008–12–08) 3 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-151 M2000 iSStar User Guide 5 HFC Library Reference 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. Synopsis GetOneFssInte(integrityNE, fssId) Note None. Parameter Description Parameter Description integrityNE Refers to an NE integrity report. The parameter value is the return value of 5.4.15 Function: GetOneNEInteLst. fssId Refers to an ID of a function subset. NOTE By using 5.4.13 Function: GetFunctionSubSetList, you can specify the IDs and names of all the function subsets of an NE type so that you can obtain the ID of a certain function subset. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100; 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. Synopsis GetOneIntegrity(resultNeIntegrityLst, neFdn, fssId) Note None. Parameter Description Parameter Description resultNeIntegrityLst Refers to an integrity result. This parameter value is the return value of 5.4.14 Function: QueryIntegrityResult. neFdn Refers to the FDN of an NE. fssId Refers to an ID of a function subset. NOTE By using 5.4.13 Function: GetFunctionSubSetList, you can specify the IDs and names of all the function subsets of an NE type so that you can obtain the ID of a certain function subset. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-153 M2000 iSStar User Guide 5 HFC Library Reference t = GetOneFssInte(l,67109473) d = GetOneIntegrity(li,'.3221229568.3221233664.3221282842',67109391) Print(d) Result fssId: 67109391;actualNum: 0;dueNum: 0;percentOfIntegrity: 100; 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. 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 Table 5-10 Description of conditions for querying performance data Name Detailed Information NE_FDN NE_FDN is a string and refers to the NE FDN. TIME_MODE Refers to the time mode. The values and meanings are as follows: l NE_MODE: NE time mode l SERVER_MODE: server time mode NOTE The default time mode is server time mode. 5-154 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Name Detailed Information FUNCTION_SUBSET Refers to the function subset ID and is a numeral. Unless otherwise specified, the default value is -1. NOTE You can obtain the IDs and names of all the function subsets of a specified NE type by referring to 5.4.13 Function: GetFunctionSubSetList. Thus, you can obtain the ID of a certain function subset. TIME_DEFAULT Refers to the date range within which the performance data is to be queried. The values and meanings are as follows: l TODAY: Today l YESTERDAY: Yesterday l THISWEEK: This week l LASTWEEK: Last week l SPEC: The date range is specified by START_TIME and END_TIME. l ALL: All time NOTE l Unless otherwise specified, the default value of TIME_DEFAULT is ALL. l The time specified by START_TIME and END_TIME can be used as a query condition only when TIME_DEFAULT is set to SPEC. Refers to a measurement period. The values and meanings are as follows: PERIOD l P5: 5 minutes l P15: 15 minutes l P30: 30 minutes l P60: 60 minutes l P1440: 1440 minutes (24 hours) NOTE The default period is 30 minutes. START_TIME Refers to the start time of the time range for querying performance records. The start time is a string and its format is as follows: yyyymm-dd HH:mm:ss. END_TIME Refers to the end time of the time range for querying performance records. The end time is a string and its format is yyyy-mm-dd HH:mm:ss. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-155 M2000 iSStar User Guide 5 HFC Library Reference Name Detailed Information COUNTERID_SEQ Refers to the sequence of counter IDs and is displayed in a list. Each element in the list is a counter ID. NOTE You can obtain the counter ID of an NE by referring to 5.4.26 Function: GetCounterInfo. OBJINSTANCE_SEQ Refers to the sequence of object indexes and is displayed in a list. Each element in the list is an integer indicating an object index number. 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 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. Synopsis GetFmCond() Note None. 5-156 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 Table 5-11 Description of conditions for querying alarm data Name Detailed Information ALARM_CATE Refers to the alarm type. The values and meanings are as follows: l 1: Current fault alarm l 2: Event alarms l 3: History fault alarm NOTE The default alarm type is current fault alarm. TIME_MODE Refers to the time mode. The values and meanings are as follows: l NE_MODE: NE time mode l SERVER_MODE: server time mode NOTE The default time mode is server time mode. START_TIME Refers to the start time of the time range for querying alarm records. The start time is a string and its format is yyyy-mm-dd HH:mm:ss. END_TIME Refers to the end time of the time range for querying alarm records. The end time is a string and its format is yyyy-mm-dd HH:mm:ss. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-157 M2000 iSStar User Guide 5 HFC Library Reference Name Detailed Information ALARMINFO_SEQ Refers to the sequence of alarm information, which is displayed in a list. Each element in the list is a tuple and its format is (Proudct ID, NE type, Alarm ID). Product ID refers to the type of the product on which an alarm is generated. The values and meanings are as follows: l 1: Transmission l 2: Mobile l 3: Fixed network narrowband l 4: Fixed network wideband l 5: Intelligent l 6: Network management NE type refers to the type of the NE on which an alarm is generated. The values and meanings are as follows: l 100000: OMC l 1: RNC l 2: NodeB l 3: SGSN l 4: GGSN l 5: CG l 6: SoftX l 7: MGW l 8: HLR Alarm ID refers to the ID of an NE and is an integer. If the product ID and NE type are specific, the alarms of a certain type can be uniquely identified. The value of the alarm ID can be any integer except -1. NEFDN_SEQ 5-158 Refers to the FDN sequence of NEs and is displayed in a list. Each element in the list is an FDN. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Name Detailed Information ALARMCAUSE_SEQ Refers to the type sequence of alarm causes and is displayed in a list. The values and meanings are as follows: ALARMLEVEL_SEQ Issue 01 (2008–12–08) l 1: Power system l 2: Environment system l 3: Signaling system l 4: Relay system l 5: Hardware system l 6: Software system l 7: Operating system l 8: Communication system l 9: Quality of service (QoS) l 10: Handling error l 11: Internal network management system (NMS) Refers to the sequence of alarm severities and is displayed in a list. The list contains unlimited elements indicating alarm severities. Unless otherwise specified, set the length of the sequence to 0. The values and meanings are as follows: l 1: Critical l 2: Major l 3: Minor l 4: Warning l 5: Unassured Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-159 M2000 iSStar User Guide 5 HFC Library Reference Name Detailed Information ALARMSTATUS_SEQ Refers to the sequence of alarm states and is displayed in a list. The list contains unlimited elements indicating alarm states. Unless otherwise specified, set the length of the sequence to 0. In the case of 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 In the case of event alarms, the values and meanings are as follows: 5-160 l 5: Acknowledged l 6: Unacknowledged LINKFDN_SEQ Refers to the sequence of link FDNs and is displayed in a list. Each element in the list is a string indicating the FDN of the link to be queried. The FDN uniquely identifies a link for link data configuration. The list contains unlimited elements. Unless otherwise specified, set the length of the sequence to 0. LINKTYPE_SEQ Refers to the sequence of link types. The values and meanings are as follows: l 400: MTP3 l 401: MTP3B l 408: H248 l 409: BICCSCTP l 410: M3UA l 499: DATA Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Name Detailed Information IDENTIF_SEQ Refers to the sequence of alarm identifiers and is displayed in a list. Each element in the list is an alarm identifier. In the case of fault alarms, the values and meanings are as follows: l 0: Note l 1: Intermittent fault l 2: High frequency flash fault In the case of event alarms, the values and meanings are as follows: l 0: Note l 3: Repeat event l 4: High frequency 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 5.4.20 Function: QueryRecord The QueryRecord function is used to query the performance data or alarm data that meets the query conditions. Synopsis QueryRecord(queryCond) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-161 M2000 iSStar User Guide 5 HFC Library Reference 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference lens=RecordCount(iter) Print(lens) Result of Example 2 71 5.4.21 Function: RecordCount The RecordCount function is used to obtain the records returned by the QueryRecord function. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-163 M2000 iSStar User Guide 5 HFC Library Reference 5.4.22 Function: NextRecord The NextRecord function is used to obtain the records obtained by the QueryRecord function. 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 True: Indicates that the record is the last record. l True: Indicates that the record is not the last record. The second element in the tuples refers to the data that is queried and displayed in a list. A maximum of 2000 elements can be contained. The elements in the list are also lists and vary based on the situation, that is, whether the found records are alarm records or performance records. 5-164 l If the found records are alarm records, a list whose length is 19 is returned. For descriptions of the elements in the list, see Table 5-12. l If the found records are performance records, a list whose length is uncertain is returned. The first fourth elements of the list are fixed whereas the rest elements vary based on the found performance counters. For descriptions of the elements in the list, see Table 5-13. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Table 5-12 Items in the list of alarm records Location in the List Detailed Information 1 Refers to the alarm type such as a current fault alarm, event alarm, or history fault alarm. This element is an integer. The values and meanings are as follows: l 1: Current fault alarm l 2: Event alarm l 3: History fault alarm 2 Refers to the serial number (SN) of a network. This element is an integer. 3 Refers to the FDN of an NE. This element is represented by characters. 4 Refers to the SN of a device. This element is an integer. 5 Refers to the sub-device identifier of the NE on which an alarm is generated. This element is an integer. 6 Refers to the alarm ID. This element is an integer. 7 Refers to the type of alarm causes. This element is an integer. The values and meanings are as follows: Issue 01 (2008–12–08) l 1: Power system l 2: Environment system l 3: Signaling system l 4: Relay system l 5: Hardware system l 6: Software system l 7: Operating system l 8: Communications system l 9: Quality of service (QoS) l 10: Handling error l 11: Internal NMS Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-165 M2000 iSStar User Guide 5 HFC Library Reference Location in the List Detailed Information 8 Refers to the alarm severity. This element is an integer. The values and meanings are as follows: 9 10 1: Critical l 2: Major l 3: Minor l 4: Warning Refers to the clearance status of an alarm. This element is an integer. The values and meanings are as follows: l 0: Uncleared l 1: Cleared Refers to the acknowledgement status of an alarm. This element is an integer. The values and meanings are as follows: l 0: Unacknowledged l 1: Acknowledged 11 Refers to the user name of the operator who acknowledges an alarm. This element is represented by characters. 12 Refers to the user name of the operator who clears an alarm. This element is represented by characters. 13 Refers to the additional information about an alarm. This element is represented by characters. 14 Refers to the cause ID of an alarm. This element is an integer. 15 Refers to the FDN of the alarm link. This element is an integer. 16 Refers to the type of an alarm link. This element is an integer. The values and meanings are as follows: 17 5-166 l l -1: Indicates that the alarm is not a link alarm. l An integer that is greater than 0: Indicates that the alarm is a link alarm. Refers to the time when an alarm is generated. This element is represented by characters and its format is yyyy-mm-dd HH:mm:ss. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Location in the List Detailed Information 18 Refers to the time when an alarm is acknowledged. This element is represented by characters and its format is yyyy-mm-dd HH:mm:ss. 19 Refers to the time when an alarm is cleared. This element is represented by characters and its format is yyyy-mm-dd HH:mm:ss. Table 5-13 Items in the list of alarm records Location in the List Detailed Information 1 Refers to the start time of the query. This element is represented by characters and its format is yyyy-mm-dd HH:mm:ss. 2 Refers to the end time of the query. This element is represented by characters and its format is yyyy-mm-dd HH:mm:ss. 3 Refers to the name of an performance measurement object. This element is represented by characters. 4 Refers to the credibility identifier of a result. This element is a Boolean value. The values and meanings are as follows: 5 ... Issue 01 (2008–12–08) l True: Credible l False: Incredible Refers to a performance counter. This element is a tuple and its format is as follows: (ID, Value). The meanings are as follows: l ID: Refers to an integer indicating the ID of a performance counter. l Value: Refers to the value of a performance counter. The value can be a string or an integer. Refers to a counter. This element is a tuple and its format is (ID, Value). The meanings are as follows: l ID: Refers to an integer indicating the ID of a performance counter. l Value: Refers to the value of a performance counter. The value can be a string or an integer. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-167 M2000 iSStar User Guide 5 HFC Library Reference NOTE Starting from the fifth element, all the elements in the list are performance counter tuples. Performance counters are grouped into integer counters (the counter values are integers) and character counter (the counter values are characters). Error Handling If an error occurs, you can obtain the error information by referring to Function: GetLastError and Function: GetErrorMsg. Example 1 #Create alarm query object cond=GetFmCond() cond[START_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,01,00,00,00,0,1,0)) cond[END_TIME]=StrfTime(TIME_FORMAT,t=(2008,12,29,23,59,59,0,1,0)) record=QueryRecord(cond) count=RecordCount(record) returnCode=False while not returnCode returnCode,lists=NextRecord(record) lens=len(lists) if lens==0 break end #Get the first record oneRecord=lists[0] recordLen=len(oneRecord) Print(oneRecord) end Result of Example 1 [1, 3002, '.3221229568.3221233664.3221291008', 1, '. 3221229568.3221233664.3221291008', 405, 5, 2, 0, 0, '', '', 'Site No.=0,Cell Index.=0,Site Type=0,Site Name=please replace,Cell Name=please replace', 0, '', -1, '2008-12-05 14:26:04', '0000-00-00 00:00:00', '0000-00-00 00:00:00'] Example 2 fdn = GetNEFDN('CBSC_241') #fdn='.3221229568.3221233664.3221286947' #Create performance query object cond=GetPmCond() #Set query conditions cond[FUNCTION_SUBSET]=1157627909 cond[NE_FDN]=fdn cond[COUNTERID_SEQ]=[1157627932,1157627934,1157627935,1157627936,1157627937,1157628216] iter=QueryRecord(cond) returnCode=False while not returnCode returnCode,lists=NextRecord(iter) lens=len(lists) if lens==0 break end #Get the first record oneRecord=lists[0] recordLens=len(oneRecord) Print(oneRecord) end 5-168 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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)] 5.4.23 Function: GetMocAttrNameList The GetMocAttrNameList function is used to query MOC attribute names based on MOC names and NE FDNs. Synopsis GetMocAttrNameList(mocName, neFdn) Note None. Parameter Description Parameter Description mocName mocName is a string and refers to an MOC name. neFdn neFdn is a string and refers to an NE FDN. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-169 M2000 iSStar User Guide 5 HFC Library Reference 5.4.24 Function: GetMocList The GetMocList function is used to query the MOC name of an NE based on the FDN of the NE. 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'] 5.4.25 Function: GetNeObjInfo The GetNeObjInfo function is used to obtain the information about the NE performance measurement objects of a certain type based on the function set ID and FDN of an NE. Synopsis GetNeObjInfo(funcSubsetId, neFdn) 5-170 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Note None. Parameter Description Parameter Description funcSubsetId funcSubsetId is an integer and refers to the function subset ID of an NE. You can obtain funcSubsetId by referring to 5.4.28 Function: GetFuncSubSetList. 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')] 5.4.26 Function: GetCounterInfo The GetCounterInfo function is used to obtain the information about performance counters based on the function subset IDs and measurement periods of NEs. Synopsis GetCounterInfo(funcSubsetId, period) Note None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-171 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description funcSubsetId funcSubsetId is an integer and refers to the function subset ID of an NE. You can obtain funcSubsetId by referring to 5.4.28 Function: GetFuncSubSetList. period period is an enumerated value and refers to the measurement period of an NE, which can take on the following values: l P5: 5 minutes l P15: 15 minutes l P30: 30 minutes l P60: 60 minutes l P1440: 1440 minutes (24 hours) 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')] 5.4.27 Function: GetFuncSetList The GetFuncSetList function is used to obtain the information about NE function sets based on NE types. Synopsis GetFuncSetList(neTypeId) Note None. 5-172 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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'),...] 5.4.28 Function: GetFuncSubSetList The GetFuncSubSetList function is used to obtain the information about NE function subsets based on the IDs of NE function sets. Synopsis GetFuncSubSetList(funcsetId) Note None. Parameter Description Parameter funcsetId Issue 01 (2008–12–08) 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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-173 M2000 iSStar User Guide 5 HFC Library Reference 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')] 5.4.29 Function: GetMoiAttrValueList The GetMoiAttrValueList function is used to obtain MOI attribute values based on the MOI information and the list of attribute names. 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 l moiFdn: MOI FDN l neFdn: NE FDN attrList is a list of attribute names. Each element in the list is a string. NOTE If the list of attribute names is [], that is, the list is null, it indicates that all attribute values of this MOI are to be queried. 5-174 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Return Value Refers to the MOC attribute values obtained through the GetMoiAttrValueList function and displayed in a list. The list format is [value1, value2, ...]. Error Handling If an error occurs, you can obtain the error information by referring to Function: GetLastError and Function: GetErrorMsg. Example 1 moi=(3221987331L, '.3221287013.3221975040.3221979139.3221987331', '.3221229568.3221233664.32212 moiattr=GetMoiAttrValueList(moi,[]) Print(moiattr) Result of Example 1 ['NULL', 'NULL', 'NULL', 'NULL', 'Cabinet No.=0, Site Index=3', '116', 'NULL'] Example 2 moi=(3221987329L, '.3221287013.3221975040.3221979136.3221987328', '.3221229568.3221233664.32212 moiattr=GetMoiAttrValueList(moi,['CabinetGrpNo', 'CabinetNo', 'CabinetType', 'name', 'SiteIndex' Print(moiattr) Result of Example 2 ['NULL', 'NULL', 'NULL', 'Cabinet No.=0, Site Index=1', 'NULL', '116'] 5.4.30 Function: GetMoiListByFilter The GetMoiListByFilter function is used to query the MOIs of an MOC based on the MOC name, NE FDN, and filtering conditions. Synopsis GetMoiListByFilter(mocName, neFdn, attrFilters) Note None. Parameter Description Parameter Description mocName mocName is a string and refers to the MOC name. neFdn neFdn is a string and refers to the NE FDN. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-175 M2000 iSStar User Guide 5 HFC Library Reference 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 attr1: Refers to an enumerated value that is used to specify the relation between this filtering condition and the subsequent filtering condition. The values and meanings are as follows: – AND: The filtering condition and the subsequent filtering condition must be met at the same time. – AND: The filtering condition and the subsequent filtering condition need not be met at the same time. – End: No subsequent filtering condition exists. l attr2: Refers to a string that is used to specify the name of an MOI attribute. You can obtain the name of an MOI attribute by referring to 5.4.23 Function: GetMocAttrNameList. l attr3: Refers to a string. l attr4: Refers to an enumerated value that is used to specify the relation between attr2 and attr3. The values and meanings are as follows: – R: Greater than – L: Less than – Equal: Equal to – Unequal: Unequal to – BEqual: Greater than or equal to – LEqual: Less than or equal to NOTE If the filtering condition is [], that is, there is no filtering condition, it indicates that all MOIs of all MOCs are to be queried. Return Value Refers to the list of the MOIs obtained through the GetMoiListByFilter function. The tuple format is [MOI1, MOI2, …]. Each element in the list is a tuple and its format is (objId, moiFdn, neFdn). The meanings of the elements in the tuple are as follows: l objId: MOI ID l moiFdn: MOI FDN l neFdn: NE FDN Error Handling If an error occurs, you can obtain the error information by referring to Function: GetLastError and Function: GetErrorMsg. 5-176 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Example 1 #Get the Fdn of the NE fdn=GetNEFDN('ty') mocuni=GetMoiListByFilter('BSC6000SiteCabinet',fdn,[]) Print(mocuni) Result of Example 1 [(3221987328L, '.3221287013.3221975040.3221979136.3221987328', '. 3221229568.3221233664.3221287013'), (3221987329L, '. 3221287013.3221975040.3221979137.3221987329', '. 3221229568.3221233664.3221287013'), (3221987330L, '. 3221287013.3221975040.3221979138.3221987330', '. 3221229568.3221233664.3221287013'), (3221987331L, '. 3221287013.3221975040.3221979139.3221987331', '. 3221229568.3221233664.3221287013'), (3221987332L, '. 3221287013.3221975040.3221979140.3221987332', '. 3221229568.3221233664.3221287013')] Example 2 #Get the Fdn of the NE fdn=GetNEFDN('ty') mocuni=GetMoiListByFilter('BSC6000SiteCabinet',fdn,[(END,'name','Cabinet No.=0, Site Index=1',E Print(mocuni) Result of Example 2 [(3221987329L,'.3221287013.3221975040.3221979137.3221987329','. 3221229568.3221233664.3221287013')] 5.4.31 Function: GetPmNeType The GetPmNeType function is used to obtain the information about NE types, including the names and IDs of NE types. Synopsis GetPmNeType([typeName]) Note None. Parameter Description Parameter typeName Issue 01 (2008–12–08) Description typeName is a string and refers to the type name of an NE. This parameter is optional. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-177 M2000 iSStar User Guide 5 HFC Library Reference Return Value The information obtained through the GetPmNeType function varies based on the actual situation, that is, whether parameters are provided when the function is invoked: l If parameters are not provided, the information obtained through the function consists of the names and IDs of NE types and is displayed in a list. The list format is [netypeInfo1, netypeInfo2, ...]. Each element in the list is a tuple and its format is (NE type ID, NE type name). l If parameters are provided, the information obtained through the function consists of the names and IDs of the NE types specified by typeName. The information is a tuple and its format is (NE type ID, NE type name). Error Handling If an error occurs, you can obtain the error information by referring to Function: GetLastError and Function: GetErrorMsg. Example 1 neInfo=GetPmNeType() Print(neInfo) Result of Example 1 [(76, 'BSC6000'), (69, 'CBSC'), (6, 'MGW'), (5, 'MSCServer'), (3, 'NodeB'), (4, 'RNC'), (11, 'SG7000'), (7, 'SGSN'), (77, 'SPS')] Example 2 neInfo=GetPmNeType('NodeB') Print(neInfo) Result of Example 2 (3, 'NodeB') 5.4.32 Function: GetNeInfo The GetNeInfo function is used to obtain the NE information based on the NE FDN, such as the NE name and type ID. Synopsis GetNeInfo(neFdn) Note None. 5-178 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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) 5.4.33 Function: CloseDB This describes the CloseDB function, which enables you to close the connection with the database center. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-179 M2000 iSStar User Guide 5 HFC Library Reference Example #Connect the database. OpenDB("admin", "11111111") #Close the database connection. returncode = CloseDB() Print('CloseDB() return: ' + str(returncode)) Result CloseDB() return: 1 5.5 Alarm Operation Function This describes the alarm operation function. This function enables you to send to the M2000 the detected exceptions during the running of a script. In this way, you can monitor and manage the exceptions occurred on the network. The alarms that can be sent are fault alarms, clearance alarms, and event alarms. 5.5.1 Overview of Alarm Operation Function This describes the alarm operation function. By using this function, you can send alarm information to the M2000. 5.5.2 Function: SendAlarm This describes the SendAlarm function. This function enables you to send alarms to the M2000. The alarm information involves alarm ID, alarm category, and alarm details. 5.5.1 Overview of Alarm Operation Function This describes the alarm operation function. By using this function, you can send alarm information to the M2000. When maintaining and monitoring a network, you are always required to report the exceptions occurred on the system. The alarm operation functions provided by the iSStar well assist you in this task. The alarm information sent by the alarm sending functions are saved in the alarm database. You can view the information about the sent alarms on the M2000 client. Table 5-14 lists the alarm operation functions. Table 5-14 Alarm function list Function Description 5.5.2 Function: SendAlarm Sends alarms to the system. 5.5.2 Function: SendAlarm This describes the SendAlarm function. This function enables you to send alarms to the M2000. The alarm information involves alarm ID, alarm category, and alarm details. 5-180 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 Alarm ID. This parameter is of integer type. category Alarm category. This parameter is of integer type. The meanings are as follows: l 1: fault alarm l 2: clearance alarm l 3: event alarm Detailed information about an alarm. This parameter is of string type. 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.6 OM Operation Function This describes the OM operation function. This function enables you to obtain the version number of the NM software, record the operations of a script, and generate logs. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-181 M2000 iSStar User Guide 5 HFC Library Reference 5.6.1 Overview of OM Operation Function OM operation functions refer to the GetOMCVersion function and the LOG_OP function. 5.6.2 Function: GetOMCVersion This describes the GetOMCVersion function. This function enables you to obtain the version number of the current NM system. 5.6.3 Function: LOG_OP This describes the LOG_OP function. This function records the operations of a script and generates operation logs. 5.6.1 Overview of OM Operation Function OM operation functions refer to the GetOMCVersion function and the LOG_OP function. By using the OM operation functions provided by the iSStar, you can obtain the version information about the current NM. In addition, you can record the operations of the codes in a script anytime and generate operation logs. You can query the log information on the M2000 client. Table 5-15 lists the OM operation functions. Table 5-15 OM function list Function Description 5.6.2 Function: GetOMCVersion Returns the version number of the current NM system. 5.6.3 Function: LOG_OP Records the operations of a script and generates operation logs. 5.6.2 Function: GetOMCVersion This describes the GetOMCVersion function. This function enables you to obtain the version number of the current NM system. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Error Handling None Example version = GetOMCVersion() Print("OMC Version is: %s"%version) Result OMC Version is: iManagerM2000V200R006C01B060 5.6.3 Function: LOG_OP This describes the LOG_OP function. This function records the operations of a script and generates operation logs. 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 opName is a string. It indicates the operation name. targetName targetName is a string. It indicates the name of the operation object. detailInfo detailInfo is a string. It indicates the operation details. auditResult detailInfo is an integer. The meanings are as follows: l 0: The operation succeeded. l 1: The operation failed. l 2: The operation partially succeeded. l 3: The operation started. Return Value The return value is null. Error Handling None Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-183 M2000 iSStar User Guide 5 HFC Library Reference 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 5.7 Type Conversion Function 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.7.1 Function: String2Int This function convert a string into an integer value. 5.7.2 Function: String2Float This function converts a string into a float value. 5.7.3 Function: String2Long This function converts a string into a long value. 5.7.4 Function: Sequence2Tuple This function converts a sequence into a tuple. 5.7.5 Function: Sequence2List This function converts a sequence into a list. 5.7.6 Function: ToString This function converts a value of any type into a string. 5.7.1 Function: String2Int This function convert a string into an integer value. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. l The second element is the integer value after conversion. Error Handling Obtain the error information by using the GetLastError function and the GetErroMsg function. Example Print("================String2Int(value) Wrong====================") Print(String2Int('')) Print(String2Int('3.0')) Print("================String2Int(value) Correct====================") Print(String2Int('3')) Print(String2Int('-3')) Result ================String2Int(value) Wrong==================== (False, '') (False, '3.0') ================String2Int(value) Correct==================== (True, 3) (True, -3) 5.7.2 Function: String2Float This function converts a string into a float value. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-185 M2000 iSStar User Guide 5 HFC Library Reference 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. l The second element is the float value after conversion. Error Handling Obtain the error information by using the GetLastError function and the GetErroMsg function. Example Print("================String2Float(value) Wrong====================") Print(String2Float('')) Print(String2Float('abc')) Print("================String2Float(value) Correct====================") Print(String2Float('3.0')) Print(String2Float('0.5')) Result ================String2Float(value) Wrong==================== (False, '') (False, 'abc') ================String2Float(value) Correct==================== (True, 3.0) (True, 0.5) 5.7.3 Function: String2Long This function converts a string into a long value. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. l The second element is the long value after conversion. Error Handling Obtain the error information by using the GetLastError function and the GetErroMsg function. Example Print("================String2Long(value) Wrong====================") Print(String2Long('')) Print(String2Long('3.0')) Print("================String2Long(value) Correct====================") Print(String2Long('3')) Print(String2Long('-3')) Result ================String2Long(value) Wrong==================== (False, '') (False, '3.0') ================String2Long(value) Correct==================== (True, 3L) (True, -3L) 5.7.4 Function: Sequence2Tuple This function converts a sequence into a tuple. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-187 M2000 iSStar User Guide 5 HFC Library Reference 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. l The value of the second element is the tuple after conversion. Error Handling Obtain the error information by using the GetLastError function and the GetErroMsg function. Example Print("================Sequence2Tuple(value) Wrong====================") Print(Sequence2Tuple(123)) Print("================Sequence2Tuple(value) Correct====================") Print(Sequence2Tuple("abc")) Print(Sequence2Tuple([1,2,3])) Result ================Sequence2Tuple(value) Wrong==================== (False, 123) ================Sequence2Tuple(value) Correct==================== (True, ('a', 'b', 'c')) (True, (1, 2, 3)) 5.7.5 Function: Sequence2List This function converts a sequence into a list. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. l The value of the second element is the list after conversion. Error Handling Obtain the error information by using the GetLastError function and the GetErroMsg function. Example Print("================Sequence2List(value) Wrong====================") Print(Sequence2List(123)) Print("================Sequence2List(value) Correct====================") Print(Sequence2List('abc')) Print(Sequence2List((1,2,3))) Result ================Sequence2List(value) Wrong==================== (False, 123) ================Sequence2List(value) Correct==================== (True, ['a', 'b', 'c']) (True, [1, 2, 3]) 5.7.6 Function: ToString This function converts a value of any type into a string. Synopsis ToString(value) Note The conversion rule of this interface is the same as that of Python. Description Parameter value Issue 01 (2008–12–08) Description Data to be converted. The data can be of any type. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-189 M2000 iSStar User Guide 5 HFC Library Reference Return Value The function returns a binary tuple. l The value of the first element in the tuple is Boolean. True indicates that the type conversion succeeds. False indicates that the type conversion fails. l The second element is the string after conversion. Error Handling Obtain the error information by using the GetLastError function and the GetErroMsg function. Example Print("================ToString(value)====================") a=[1] b={"b":2} c=(a,b,3) Print(ToString(a)) Print(ToString(b)) Print(ToString(c)) Print(ToString(None)) Result ================ToString(value)==================== (True, '[1]') (True, "{'b': 2}") (True, "([1], {'b': 2}, 3)") (True, 'None') 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.8.1 Overview of Time Function The time function provided in the iSStar can be used to obtain the information on time. 5.8.2 Time Format This section describes all the time formats contained in the return value string (StrfTime). 5.8.3 Time Tuple A time tuple includes the following elements: year, month, date, hour, minute, second, week, day, and DST. The return value of the LocalTime or GMTime function is a time tuple. 5.8.4 Function: GMTime This function is used to return the GMT time according to the difference (second) of the GMT time and the epoch time. If you only know the difference of the GMT time and the epoch time, you can obtain the specific GMT time through the GMTime function. Greenwich Mean Time (GMT) is also called Universal Coordinated Time (UTC). 5.8.5 Function: LocalTime This function is used to return the local time according to the difference (second) of the local time and the epoch time. If you only know the difference of the local time and the epoch time, you can obtain the specific local time through the LocalTime function. 5-190 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.8.6 Function: MkTime This function returns the difference between the GMT time (or local time) and the epoch time. The unit is second. 5.8.7 Function: Sleep This function is used to continue to execute the next statement after pausing the required time. 5.8.8 Function: StrfTime This function is used to convert the time represented in tuple into the string in a specified time format. 5.8.9 Function: StrpTime This function is used to convert the time string in a specified format into the time tuple. 5.8.10 Function: Time This function enables you to obtain the GMT time and convert it into the difference (expressed in second) between 1970/01/01 00:00:00 and the current local time. 5.8.11 Function: CTime This function enables you to obtain the string of the local time. 5.8.12 Function: AscTime This function enables you to convert the tuple indicating the time into a string containing 24 characters. 5.8.1 Overview of Time Function The time function provided in the iSStar can be used to obtain the information on time. Through the time function, you can obtain the Greenwich Mean Time (GMT) time and local time. Also, you can convert the format of the obtained time. The time functions provided in the iSStar is listed in Table 5-16. Table 5-16 List of time functions Function Description 5.8.4 Function: GMTime This function is used to return the GMT time according to the difference of the GMT time and the epoch time. 5.8.5 Function: LocalTime This function is used to return the local time according to the difference (second) of the local time and the epoch time. 5.8.6 Function: MkTime This function returns the difference between the GMT time (or local time) and the epoch time. The unit is second. 5.8.7 Function: Sleep This function is used to continue to execute the next statement after pausing the required time. 5.8.8 Function: StrfTime This function is used to convert the time represented in tuple into the string with a specified time format. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-191 M2000 iSStar User Guide 5 HFC Library Reference Function Description 5.8.9 Function: StrpTime This function is used to convert the time string in a specified format into the time tuple. 5.8.10 Function: Time This function is used to obtain the GMT time and converts it into the difference (second) of the epoch time (1970/01/01 00:00:00) and the current GMT time. 5.8.11 Function: CTime This function is used to obtain the local time string. 5.8.12 Function: AscTime This function is used to convert the tuple indicating the time into the string containing 24 characters. 5.8.2 Time Format This section describes all the time formats contained in the return value string (StrfTime). Time Format Format 5-192 Description %a Abbreviated weekday name in the local time. %A Full weekday name in the local time. %b Abbreviated month name in the local time. %B Full month name in the local time. %c Appropriate date and time representation in the local time. %d Day of the month as a decimal number [01, 31]. %H Hour (24-hour clock) as a decimal number [00, 23]. %I Hour (12-hour clock) as a decimal number [01,12]. %j Day of the year as a decimal number [001, 366]. %m Month as a decimal number [01,12]. %M Minute as a decimal number [00, 59]. %p Equivalent of either AM or PM in the local time. %S Second as a decimal number [00, 59]. %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. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Format Description %w Weekday as a decimal number [0(Sunday),6]. %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 Appropriate date representation in the local time. %X Appropriate time representation in the local time. %y Year without century as a decimal number [00, 99]. %Y Year with century as a decimal number. %Z Time zone name (no characters if no time zone exists). %% A literal "%" character. 5.8.3 Time Tuple A time tuple includes the following elements: year, month, date, hour, minute, second, week, day, and DST. The return value of the LocalTime or GMTime function is a time tuple. Tuple Elements No. Element Value Range Description 0 Year 0-9999 Full year name, for example, 2006 1 Month 1-12 Month as a numerical value 2 Date 1-31 Date as a numerical value 3 Hour 0-23 Hour, in 24-hour format, as a numerical value 4 Minute 0-59 Minute as a numerical value 5 Second 0-59 Second as a numerical value 6 Week 0-6 Weekday as a numerical value (0 indicates Monday) 7 Day 1-366 Day of the year as a numerical value -1, 0, and 1 1 indicates that the DST is used. 0 indicates that the DST is not used. -1 indicates that the DST is not available. 8 Issue 01 (2008–12–08) DST Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-193 M2000 iSStar User Guide 5 HFC Library Reference 5.8.4 Function: GMTime This function is used to return the GMT time according to the difference (second) of the GMT time and the epoch time. If you only know the difference of the GMT time and the epoch time, you can obtain the specific GMT time through the GMTime function. Greenwich Mean Time (GMT) is also called Universal Coordinated Time (UTC). 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) 5.8.5 Function: LocalTime This function is used to return the local time according to the difference (second) of the local time and the epoch time. If you only know the difference of the local time and the epoch time, you can obtain the specific local time through the LocalTime function. 5-194 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.8.6 Function: MkTime This function returns the difference between the GMT time (or local time) and the epoch time. The unit is second. Synopsis MkTime([t]) Note None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-195 M2000 iSStar User Guide 5 HFC Library Reference 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. t 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 5.8.7 Function: Sleep This function is used to continue to execute the next statement after pausing the required time. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.8.8 Function: StrfTime This function is used to convert the time represented in tuple into the string in a specified time format. 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. t t indicates the time. It is a tuple containing nine elements. The default return value is the return value of the LocalTime function. The parameter t can be the return value of the GMTime or LocalTime function. Return Value The formatted time string is returned. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-197 M2000 iSStar User Guide 5 HFC Library Reference Error Handling None. Example Print(StrfTime("%a, %d %b %Y %H:%M:%S +0000", GMTime())) Result Fri, 13 Oct 2006 09:52:24 +0000 5.8.9 Function: StrpTime This function is used to convert the time string in a specified format into the time tuple. Synopsis StrpTime(string,format=None) Note None Parameter Description Parameter Description string It is a time string to be converted. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.8.10 Function: Time This function enables you to obtain the GMT time and convert it into the difference (expressed in second) between 1970/01/01 00:00:00 and the current local time. 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 5.8.11 Function: CTime This function enables you to obtain the string of the local time. Synopsis CTime() Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-199 M2000 iSStar User Guide 5 HFC Library Reference 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 5.8.12 Function: AscTime This function enables you to convert the tuple indicating the time into a string containing 24 characters. Synopsis AscTime([t]) Note None. Parameter Description Parameter t 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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.9 Input and Output Function This section describes input and output functions and the function of setting the output mode. 5.9.1 Overview of Input and Output Functions The iSStar provides input and output functions. These functions are used to set the information output mode, obtain the user input information, and display the output information. 5.9.2 Function: UserInput This function enables you to export the prompt information and obtain the strings entered from the client. The input information ends with Enter. InputText() is the alias of the UserInput() function. 5.9.3 Function: UserOutput The function UserOutput() is used to receive strings entered by the user on the client. OutputText () is the alias of the UserOutput() function. 5.9.4 Function: SetOutMode This function enables you to set the output mode of the Print function. 5.9.5 Function: SetOutFlag This function enables you to set the output switch of the Print function. 5.9.6 Function: SetOutFileName This function enables you to set the output file of the Print function. To call the SetOutMode function to set the output file of the Print function, you need to call the SetOutFileName function to set the output file name. 5.9.7 Function: Print This function enables you to output the string information to a target object. The target object is set by the SetOutMode function. 5.9.8 Function: GetOutputPath This function enables you to obtain the default output path of the task. 5.9.9 Function: NotifyProgress This function is used to view the execution progress of the task on the iSStar Task Manage Window progress bar. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-201 M2000 iSStar User Guide 5 HFC Library Reference 5.9.1 Overview of Input and Output Functions The iSStar provides input and output functions. These functions are used to set the information output mode, obtain the user input information, and display the output information. The output functions allow you to output the running information of the task to the interface or a specified file in the set output mode. The input functions allow you to input the information required when the task is running. Table 5-17 lists the input and output functions provided by the iSStar. Table 5-17 List of input and output functions Function Description 5.9.2 Function: UserInput This function is used to obtain entered strings from the client. 5.9.4 Function: SetOutMode This function is used to set the output mode of the Print function. 5.9.5 Function: SetOutFlag This function is used to set the output switch of the Print function. 5.9.6 Function: SetOutFileName This function is used to set the output file of the Print function. 5.9.7 Function: Print This function is used to export the string information to the target object set by the SetOutMode function. 5.9.8 Function: GetOutputPath This function is used to obtain the default output path of the task. 5.9.9 Function: NotifyProgress This function is used to view the execution progress of the task on the iSStar Task Manage Window progress bar. 5.9.2 Function: UserInput This function enables you to export the prompt information and obtain the strings entered from the client. The input information ends with Enter. InputText() is the alias of the UserInput() function. Synopsis UserInput(EventPropmt[, EventType[, Items]]), InputText(EventPropmt[, EventType[, Items]]) Note The function UserInput() is equivalent to InputText(). 5-202 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description EventPropmt EventPropmt is a string. It indicates the prompt of the user input on GUI. EventType EventType is an integer. When it is 1, the input string is returned. When it is 2, the return value is represented by *. The default value is 1. Items Items can be a sequence (string, list, or tuple). It indicates the option of the input information. There is no limit to the input information by default. NOTE l If the Items parameter is given and the parameter is a string, the input information must be the substring of Items. l If the Items parameter is given and the parameter is a list or tuple (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) # Assume the user type Hello # Assume the user type World # Assume the user type A Result UserInput() return: Hello UserInput() return: World UserInput() return: A 5.9.3 Function: UserOutput The function UserOutput() is used to receive strings entered by the user on the client. OutputText () is the alias of the UserOutput() function. Synopsis UserOutput(EventPropmt[, EventType]),OutputText(EventPropmt[, EventType]) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-203 M2000 iSStar User Guide 5 HFC Library Reference Note The function UserOutput() is equivalent to OutputText(). Parameter Description Parameter Name Description EventPropmt EventPropmt is a string. It is the message entered by the user on the client. EventType EventType is an integer. It is fixed to 0. Return Value None. Error Handling None. Example UserOutput("This is a test text of UserOutput function.") #Output the test infomation: This is Result This is a test text of UserOutput function. 5.9.4 Function: SetOutMode This function enables you to set the output mode of the Print function. Synopsis SetOutMode(Mode) Note None. 5-204 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Mode Description Mode is a string. It indicates the output mode. The value of the output modes is as follows: l 'gui': outputs to GUI l 'file': Outputs to file NOTE Before the function is invoked, the default output mode is gui. Return Value If the output mode is set successfully, 1 is returned. Otherwise, 0 is returned. Error Handling If an error occurs, you can obtain the error information through GetLastError and GetErrorMsg functions. Example SetOutMode('gui') # Set the output mode to GUI Print("Hello!") # Print the string Hello! on the GUI SetOutMode("file") # Set the output mode to file SetOutFileName("E:\\sample.txt") # Set the output file name to E:\sample.txt. Print("Hello world!") # Save the string to the file E:\sample.txt. Result Hello! (The string "Hello world!" is saved in the file E:\sample.txt.) 5.9.5 Function: SetOutFlag This function enables you to set the output switch of the Print function. Synopsis SetOutFlag(Flag) Note By default, the output switch is enabled. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-205 M2000 iSStar User Guide 5 HFC Library Reference 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 l 0.0 l 0 l [] l () l {} l None l "" l '' Other values indicate that the Print function can output the information. The default value is True, and it allows the Print function to output the information. Return Value If the function is called successfully, 1 is returned. Otherwise, 0 is returned. Error Handling If an error occurs, you can obtain the error information through the GetLastError and GetErrorMsg functions. Example SetOutFlag(False) Print("Hello world!") SetOutFlag(True) Print("Hello!") # Set output to false # The strings cannot be printed on the GUI # Set output to true # The string can be printed on the GUI Result Hello! 5.9.6 Function: SetOutFileName This function enables you to set the output file of the Print function. To call the SetOutMode function to set the output file of the Print function, you need to call the SetOutFileName function to set the output file name. Synopsis SetOutFileName(FileName) 5-206 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Note l If the output file is not set, the output mode contains the file mode. The default output file is used. l The default output file is installation path\script\output\system-generated result folder \OutputFile.txt. The rule for naming the system-generated result folder is 'script operating time in YYYYMMDDHHMMSS format'-'script name'. For example, the name of a result folder can be D:\Client\script\output\061230230059-checklink\OutputFile.txt. Parameter Description Parameter 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 5.9.7 Function: Print This function enables you to output the string information to a target object. The target object is set by the SetOutMode function. Synopsis Print(Msg) Note None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-207 M2000 iSStar User Guide 5 HFC Library Reference 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!") # Print to the GUI Result Hello world! 5.9.8 Function: GetOutputPath This function enables you to obtain the default output path of the task. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Example # Obtain the default output path returncode = GetOutputPath() Print('GetOutputPath() return: ' + returncode) Result GetOutputPath() return: C:\Client\script\output\061028093234-sample 5.9.9 Function: NotifyProgress This function is used to view the execution progress of the task on the iSStar Task Manage Window progress bar. 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 Progress is an integer, ranging from 0 to 99. It indicates the progress of a task. Description Description is a string. It indicates the description of a task. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-209 M2000 iSStar User Guide 5 HFC Library Reference Sleep(10) NotifyProgress(99, "sample Sleep 5.") 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.10.1 Overview of GetError Function The iSStar provides the GetError function. This function is used to obtain error codes and find out root causes. 5.10.2 Function: GetLastError This function enables you to obtain the last error information of the current task. The obtained information includes the error code, the function where an error occurs, and the line number of the error. 5.10.3 Function: GetErrorMsg This function enables you to obtain the cause of the error according to the error code. 5.10.4 Examples of GetError Function This section describes how to use the GetError function through the following example. 5.10.1 Overview of GetError Function The iSStar provides the GetError function. This function is used to obtain error codes and find out root causes. For the error occurred in the process of calling the HFC library function, the corresponding error code is set to indicate the causes. You can obtain the error code of the current error through the 5.10.2 Function: GetLastError function in the GetError function, and then parse the error code through 5.10.3 Function: GetErrorMsg to find out the error cause. The GetError function allows you to obtain only the error code of the last error occurred in the current task, and only one error code can be obtained at one time. The GetError functions provided by the iSStar are listed in Table 5-18. Table 5-18 List of GetError functions Function Description 5.10.2 Function: GetLastError This function enables you to obtain the last error information of the current task. 5.10.3 Function: GetErrorMsg This function enables you to obtain the cause according to the error code. 5.10.2 Function: GetLastError This function enables you to obtain the last error information of the current task. The obtained information includes the error code, the function where an error occurs, and the line number of the error. 5-210 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Synopsis GetLastError() Note None. Parameter Description None. Return Value The tuple (errID, errInfo, trace_back) is returned. The meanings of the three elements in the tuple are as follows: l errID is the error code in integer type. The initial value is 0. l errInfo is the error description in string type. By default, it is a null string ''. You need to obtain the information through the GetErrorMsg function. l trace_back is a tuple containing three elements: filename, lineno, and func_name. – filename is a string. It indicates the current file path. If no error occurs in the current file, the value is '<string>' . – lineno is an integer. It indicates the line number of the error. The initial value is 0. – func_name is a string. It indicates the name of the error function. The initial value is '?'. Error Handling None. Related Examples 5.10.3 Function: GetErrorMsg This function enables you to obtain the cause of the error according to the error code. Synopsis GetErrorMsg(errID) Note None. Parameter Description Parameter errID Issue 01 (2008–12–08) Description The value of errID is a positive integer or zero. It indicates the error code. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-211 M2000 iSStar User Guide 5 HFC Library Reference 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 Indicates the error code represented by hex. For example, the error code can be 0x0. ErrorLevel Indicates the error level. For example, the first 0 in 0x0 represents the error level. For details, see Table 5-20. ModuleID Indicates the faulty module. For example, the second 0 in 0x0 represents the faulty module. ErrorDescription Describes the details of the error. Table 5-20 Description of error level Level Meaning ERROR_LEV_OK If the value of ERROR_LEV_OK is 0, it indicates that the error level is normal. ERROR_LEV_NOTICE If the value of ERROR_LEV_NOTICE is 1, it indicates that the error is of the notice level. ERROR_LEV_WARNING If the value of ERROR_LEV_WARNING is 2, it indicates that the error is of the warning level. ERROR_LEV_ERROR If the value of ERROR_LEV_ERROR is 3, it indicates that the error is of the critical level. Error Handling None. Related Examples 5.10.4 Examples of GetError Function This section describes how to use the GetError function through the following example. Example Print("No Error Occurred") errorlist = GetLastError() 5-212 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. # Get the error code Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Print("errorlist: " + str(errorlist)) Print("error message: " + GetErrorMsg(errorlist[0])) # Get the error information 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.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.11.1 Overview of Network Operation Function iSStar provides network operation functions for network communications. Through the network operation functions, you can create FTP connections, upload files to an FTP server, download files from an FTP server, and run commands remotely. 5.11.2 Function: SetPassive This function enables you to set the transfer mode for the FTP server. 5.11.3 Function: LoginFTP This function enables you to log in to the FTP server. 5.11.4 Function: Upload This function enables you to upload the file to the connected FTP server. 5.11.5 Function: Download This function enables you to download specified files from the existing FTP server to target file path. 5.11.6 Function: GetFTPStatus This function enables you to obtain the current FTP connection status. 5.11.7 Function: LogoutFTP This function enables you to log out of the FTP server. 5.11.8 OpenTelnet Function This function enables you to remotely log in to the server and connect to the telnet. 5.11.9 ExecuteCmd Function Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-213 M2000 iSStar User Guide 5 HFC Library Reference This function enables you to run commands through the telnet. 5.11.10 IsConnected Function This function enables you to identify the status of the telnet connection. 5.11.11 CloseTelnet Function This function enables you to disconnect from a specified telnet object. 5.11.12 Example of Network Operation Function Through the example of the network operation function, you can get an overall knowledge about the usages of the FTP functions and telnet functions. 5.11.1 Overview of Network Operation Function iSStar provides network operation functions for network communications. Through the network operation functions, you can create FTP connections, upload files to an FTP server, download files from an FTP server, and run commands remotely. The network operation functions provided by iSStar are of two categories: FTP functions and telnet functions, as shown in Table 5-21 and Table 5-22. Table 5-21 FTP function list Function Description 5.11.2 Function: SetPassive Set the transmission mode for the FTP server. 5.11.3 Function: LoginFTP Log in to and connect to the FTP server. 5.11.4 Function: Upload Upload the source file to the specified FTP server. 5.11.5 Function: Download Download specified files from the existing FTP server to target folders. 5.11.6 Function: GetFTPStatus Obtain the status of the current FTP connection. 5.11.7 Function: LogoutFTP Log out of the FTP server. Table 5-22 telnet function list 5-214 Function Description 5.11.8 OpenTelnet Function Remotely log in to the server and establish a telnet connection. 5.11.9 ExecuteCmd Function Run commands through the telnet. 5.11.10 IsConnected Function Identify the status of the telnet connection. 5.11.11 CloseTelnet Function Disconnect from a specified telnet object. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference NOTE You must connect to the server before uploading files, downloading files, or running commands remotely. Through the FTP functions or the telnet functions, you can create only one connection for each task at a time. If you create another connection, the previous connection is closed. The procedure for uploading files through the FTP functions is as follows. For the instances, see 5.11.12 Example of Network Operation Function. 1. Obtain the IP address of the FTP server, the login user name and the password. 2. Upload files to the destination folder of the FTP server. 3. Log in to and connect to the FTP server. For details, see 5.11.3 Function: LoginFTP. 4. Upload files to a specified folder on the FTP server. For details, see 5.11.4 Function: Upload. 5. Log out of the FTP server. For details, see 5.11.7 Function: LogoutFTP. The procedure for downloading files through the FTP functions is as follows. For the examples, see 5.11.12 Example of Network Operation Function. 1. Obtain the IP address of the FTP server, the login user name, and the password. 2. Obtain the folder that contains the files to be downloaded. 3. Log in to and connect to the FTP server. For details, see 5.11.3 Function: LoginFTP. 4. Download files from the FTP server to the local PC. For details, see 5.11.5 Function: Download. 5. Log out of the FTP server. For details, see 5.11.7 Function: LogoutFTP. The procedure for running the command through the Telnet functions is as follows. For the instances, see 5.11.12 Example of Network Operation Function. 1. Obtain the IP address and port number of the telnet server. 2. Log in to and connect to the telnet server. For details, see 5.11.8 OpenTelnet Function. 3. Run commands through the telnet. For details, see 5.11.9 ExecuteCmd Function. 4. Disconnect from the telnet. For details, see 5.11.11 CloseTelnet Function. 5.11.2 Function: SetPassive This function enables you to set the transfer mode for the FTP server. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-215 M2000 iSStar User Guide 5 HFC Library Reference Return Value If the function is called successfully, 1 is returned. Otherwise, 0 is returned. Error Handling None. 5.11.3 Function: LoginFTP This function enables you to log in to the FTP server. Synopsis LoginFTP(Host, UserName, Password) Note l You need to call this function before performing other FTP operations. l Only one FTP connection is allowed for the same task at the same time. If the FTP login interface is used again, the established FTP connection is closed and then you need to establish a new FTP connection. Parameter Description Parameter Description Host Host is a string. It indicates the IP address of the FTP server to be logged in. UserName UserName is a string. It indicates the name of the login user. Password Password is a string. It indicates the password of the FTP server to be logged in. 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 5.11.4 Function: Upload This function enables you to upload the file to the connected FTP server. 5-216 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Synopsis Upload(SrcFile, TargetFile) Note l You need to call the LoginFTP function to connect to the server before calling this function. l The source file path and target file path must exist. Otherwise uploading fails. l If a file with the name of the uploaded one exists in the target file path, overwrite the file. l You need to upload the file in a binary mode. Parameter Description Parameter 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 5.11.5 Function: Download This function enables you to download specified files from the existing FTP server to target file path. Synopsis Download(SrcFile, TargetFile) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-217 M2000 iSStar User Guide 5 HFC Library Reference Note l You need to call the LoginFTP function to connect to the server before calling this function. l The source file path and target file path must exist. Otherwise downloading fails. l If a file with the name of the downloaded one exists in the target file path, overwrite the file. l You need to download the file in a binary mode. Parameter Description Parameter Name Description SrcFile SrcFile is a string. It indicates the name of the file to be downloaded. It supports Windows-style file path (containing \\) and Unix-style file path (containing /). TargetFile TargetFile is a string. It indicates the target file which the downloaded file is saved. It supports Windows-style file path (containing \\) and Unix-style file path (containing /). Return Value If the function is called successfully, 1 is returned. Otherwise, 0 is returned. Error Handling If an error occurs, you can obtain the error information through GetLastError and GetErrorMsg functions. Related Examples 5.11.6 Function: GetFTPStatus This function enables you to obtain the current FTP connection status. Synopsis GetFTPStatus() Note None. Parameter Description None. Return Value If the function is called successfully, 1 is returned. Otherwise, 0 is returned. 5-218 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Error Handling If an error occurs, you can obtain the error information through GetLastError and GetErrorMsg functions. Related Examples 5.11.7 Function: LogoutFTP This function enables you to log out of the FTP server. Synopsis LogoutFTP() Note l After the operation of the FTP is complete, you must call this function to ensure that the existing FTP connection is disconnected. l When the established FTP connection is disconnected, this function can still return success if you call this function again. It indicates that this function can be continuously called for many times. Parameter Description None. Return Value If the function is called successfully, 1 is returned. Otherwise, 0 is returned. Error Handling If an error occurs, you can obtain the error information through GetLastError and GetErrorMsg functions. Related Examples 5.11.8 OpenTelnet Function This function enables you to remotely log in to the server and connect to the telnet. Synopsis OpenTelnet(strHostIp, port = 23) Important None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-219 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Name Parameter Description strHostIp strHostIp is of the string type. It indicates the IP address of the remote PC to which you want to log in. port port is of the integer type. It indicates the port number of the remote PC to which you want to log in. By default, this parameter is set to 23. Return Value The return value is an object. If the function calling succeeds, the telnet object is returned. Otherwise, "None" is returned. Error Handling None. Example tel = OpenTelnet('10.121.71.188') CloseTelnet(tel) 5.11.9 ExecuteCmd Function This function enables you to run commands through the telnet. 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 TargetDir is of the string type. It indicates the command to be executed. timeout Timeout is of the integer type. It indicates the timeout value of a command. By default, the timeout value is 60 seconds. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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) 5.11.10 IsConnected Function This function enables you to identify the status of the telnet connection. 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.11.11 CloseTelnet Function This function enables you to disconnect from a specified telnet object. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-221 M2000 iSStar User Guide 5 HFC Library Reference 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) 5.11.12 Example of Network Operation Function Through the example of the network operation function, you can get an overall knowledge about the usages of the FTP functions and telnet functions. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Print("download failed!") Print(GetLastError()) end end # Log in serverIp userName password to the ftp server = UserInput("Please input ip address of ftpserver: ",0) = UserInput("Please input user name: ",0) = UserInput("Input your password: ",2) 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! Example of Telnet function # Connect a solaris Server tel = OpenTelnet('10.121.71.188') #input username rep = ExecuteCmd(tel,'root',5) Print(rep) # input password rep = ExecuteCmd(tel,'root188',5) Print(rep) rep = ExecuteCmd(tel,'ls',5) Print(rep) CloseTelnet(tel) # connect an NE telrnc = OpenTelnet('10.161.196.246',6000) #login rernc = ExecuteCmd(telrnc, 'LGI:op="lmtlmtlmt",pwd="lmtlmtlmt";',5) Print(rernc) # execute MML command rernc = ExecuteCmd(telrnc, 'LST OP:;',5) Print(rernc) CloseTelnet(telrnc) Result of Telnet function Password: Last login: Fri Aug 29 14:35:57 from 10.121.44.81 Sourcing //.profile-EIS..... root@script # 1.txt devices opt 10.121.71.188.url etc platform AMSvr export proc OMC_upgrade_bak home pycorba.txt OutputFileMML.txt kernel sbin Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-223 M2000 iSStar User Guide 5 HFC Library Reference SunWS_config lib tmp TT_DB litemp.txt toolboxes TaskInterfaceForIstar log.txt usr _vimrc logs var bin lost+found vol cache mnt workspace cdrom net xfn data nsmail yuxin dev ok1.txt root@script # ++++++++++++++++++++++++++++++++++++++++++++++++++++ WCDMA RNC maintenance system Version: BSC6800V100R011 Copyright(c) 2001-2003 All rights reserved ++++++++++++++++++++++++++++++++++++++++++++++++++++ +++ 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 The operator didn't login, please login first and execute END 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.12.1 Overview of Report Operation Function The iSStar provides report operation functions which enable you to operate reports. 5.12.2 Report Design Function This describes the report design functions. You can use these functions to add sheets, ranges, or tables, obtain the number of rows, insert or delete rows, and set display contents and style. 5.12.3 Report Display Function This describes the report display function. This function enables you to define the display style of the a table, range, or cell. For example, you can define the background color, alignment mode, font, and column width. 5.12.4 Report Management Function This describes the report management function. This function enables you to import, create, and save report files, and export report model files. 5.12.5 Parameters for Operating Report This describes the values and meanings of the report operation parameters. The parameters are Color, FontType, and Type. 5.12.6 Examples of Report Operation Function 5-224 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference This gives the examples of the report operation function. You can better understand how to use report operation functions to perform routine maintenance. 5.12.1 Overview of Report Operation Function The iSStar provides report operation functions which enable you to operate reports. The report operation functions provided by the iSStar enable you to easily create a professional report. You can write the required information to the custom report to facilitate future query. By using the report operation functions, you can perform the related operations, for example, you can set the display contents of a range, customize the display mode of a report, such as the background color and alignment mode of a table, range, or cell. Table 5-23 lists the report operation functions. Table 5-23 Report operation function list Function Description Function: NewReport Creates a report. Function: AddSheet Adds a sheet. Function: AddTable Adds a table. Function: AddRange Creates a range. Function: SetRangeValue Sets the range value. Function: SetCellValue Sets the cell-specified value. Function: SetTableValue Sets the values of multiple cells in the table. Function: SetTableValueEx Sets the contents of multiple cells in a table and specifies the display style. Function: GetRowCount Returns the number of rows in a table. Function: GetRowData Returns the data of a row in a table. Function: InsertRow Inserts a row of data in a table. Function: RemoveRow Deletes a row of data from a table. Function: UpdateRow Updates the contents of a row. Function: Selector Sets the display style of the data aggregate that meets the conditional expression. Function: ReportStyle Sets the cell display style. Function: SetTableFont Sets the table font. Function: SetTableTitleFont Sets the table title font. Function: SetRangeFont Sets the range font. Function: SetCellFont Sets the font of the specified cell. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-225 M2000 iSStar User Guide 5 HFC Library Reference Function Description Function: SetTableBGColor Sets the background color of a table. Function: SetRangeBGColor Sets the background color of a range. Function: SetCellBGColor Sets the background color of a cell. Function: SetRangeAlign Sets the alignment type of a range. Function: SetCellAlign Sets the alignment type of a cell. Function: SetColumnWidth Sets the column width. Function: LoadReport Imports a report object. Function: SaveReportAs Save the report. Function: StoreReport Exports the report model files. 5.12.6 Examples of Report Operation Function shows the examples. The procedure of report operations is as follows: 1. Create a report object. 2. Create a sheet. 3. Create a table. 4. Set the cell data and format. 5. Save the report. 5.12.2 Report Design Function This describes the report design functions. You can use these functions to add sheets, ranges, or tables, obtain the number of rows, insert or delete rows, and set display contents and style. 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 l The range cannot overlap or include each other. l When creating a range, you can specify whether to merge the cells in the range. After the cells are merged, all the operations related to the cells are invalid. You can only operate the whole range. l Before calling this function, call Function: NewReport to create a report object, call Function: AddSheet to create a sheet, and call Function: AddTable to create a table. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description TableHandle TableHandle is a long integer. It is the unique identifier of a table. RowFrom RowFrom is an integer. It indicates the start row number of the range in the table. Row number begins from 0. ColFrom ColFrom is an integer. It indicates the start column number of the range in the table. The column number begins from 0. RowTo RowTo is an integer. It indicates the end row number of the range in the table. ColTo ColTo is an integer. It indicates the end column number of the range in the table. bMerged bMerged is an integer. It indicates whether cells are merged. The value can be 1 or 0. By default, 0 is used. The values and related meanings are as follows: l 1: indicates that merging is performed. l 0: indicates that no merging is performed. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-227 M2000 iSStar User Guide 5 HFC Library Reference Function: AddSheet This describes the AddSheet function. This function enables you to add a sheet to the specified report. Synopsis AddSheet(SheetName) Note l The total number of rows in the pages is 65535, and total number of columns is 255. l SheetName cannot be null, and the length of the character string cannot be more than 31 characters. The symbols :?\./*[] are not allowed in the sheet name. l SheetName must be unique. If the new sheet name exists in the report, the invalid handle number 0 is returned after you call the AddSheet function. l Before the function is called, call Function: NewReport to create a report. Parameter Description Parameter SheetName Description SheetName is a character string. It indicates the sheet name. The sheet name must be unique. Return Value l The return value is an integer. l If the function is executed successfully, the Handle, that is, the unique identifier of the sheet, is returned. If the execution fails, 0 is returned. l If the new sheet name exists in the report, the sheet cannot be created and 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example #Create a report object. NewReport() #Add a sheet named page one. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Function: AddTable This describes the AddTable function. This function enables you to add a table to the specified page. Synopsis AddTable(SheetHandle, Row, Col, TableName = "") Note l The title of the generated table occupies one row. l If you add multiple tables to the same page, tables are separated by three blank rows. l The maximum row number is 65530, and the maximum of total column number is 255. l Before this function is called, you should call Function: NewReport to create a report and call Function: AddSheet to create a sheet. Parameter Description Parameter Description SheetHandle SheetHandle is a long integer. It indicates Handle of the page (the unique mark of the page). Row Row is an integer. It indicates the number of rows. Col Col is an integer. It indicates the number of columns. TableName TableName is a string. It indicates the table name. TableName cannot exceed 128 characters. If more 128 characters are contained, only the first 128 characters are valid. NOTE TableName is an optional parameter, but this parameter affects the table heading. If TableName is not a null string, the report has a table heading. If TableName is a null string, the report does not have a table heading. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-229 M2000 iSStar User Guide 5 HFC Library Reference page1 = 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 Name of a sheet. This parameter is of string type. TableNo Number of a table. This parameter indicates the number of the table, of which the number of rows is required, in the specified sheet. This parameter is of integer type. The value ranges from 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 Name of the sheet to be modified This parameter is of string type. TableNo Number of a table. This parameter indicates the number of the table, whose data is required, in the specified sheet. This parameter is of integer type. The value ranges from 0. RowNo Number of a row. his parameter indicates the number of the row, whose data is required, in the specified table. This parameter is of integer type. The value ranges from 0. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-231 M2000 iSStar User Guide 5 HFC Library Reference data = GetRowData(sheetName, tableNo, 2) Print(data) InsertRow( sheetName, tableNo, 2, datalist ) data = GetRowData(sheetName, tableNo, 2) Print(data) SaveReportAs("result.xls") Result ['', '', '', ''] ['data0', 'data1', 'data2', 'data3'] Related Example Function: InsertRow This describes the InsertRow function. This function enables you to insert a row in the specified table according to the row number. Synopsis InsertRow(SheetName,TableNo,RowNo,DataList) Note None Parameter Description Parameter Description SheetName Name of a sheet. This parameter is of string type. TableNo Number of a table. This parameter indicates the number of the table, to which you plan to insert data, in the specified sheet. This parameter is an integer ranging from 0. RowNo Number of a row. This parameter indicates the number of the table, to which you plan to insert a row. The value is an integer ranging from 0. The value -1 indicates the last row. DataList Data list. This parameter indicates the data to be inserted. This parameter is of string sequence type. Return Value The return value is an integer. If this function is successfully called, 1 is returned. Otherwise, 0 is returned. 5-232 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 Name of a sheet. This parameter is of string type. TableNo Number of a table. This parameter indicates the number of the table, whose data needs to be deleted, in the specified sheet. This parameter is of integer type. The value ranges from 0. RowNo Number of a row. Number of the row to be deleted The value is an integer ranging from 0. The default value is -1, which indicates the last row. Return Value The return value is an integer. If row number is modified successfully called, 1 is returned. Otherwise, 0 is returned. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-233 M2000 iSStar User Guide 5 HFC Library Reference 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 $X: indicates the x row. l :$Y: indicates the y column. l $$: indicates the whole table. Table 5-24 describes the instances of the common conditional expressions supported by the iSStar. Default 5-234 Default is of integer type. It indicates the identifier of the display style. It is the return value of the Function: Selector function. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 CELL_MODE: applies to only the specific placement that meets the requirement. l ROW_MODE: applies to the entire row of the placement that meets the requirement. l COL_MODE: applies to the entire column of the placement that meets the requirement. Table 5-24 Example of Using Conditional Expressions Conditional Expression Meaning $1:$2 == 'Error' and $2:$1 == 'Unavailable' Indicates that in a data aggregate, the condition is met if the data in row 1 column 2 is error and the data in row 2 column 1 is unavailable. The data aggregate of row 1 column 2 and row 2 column 1 is returned. NOTE The configuration mode of this type of expression can only be CELL_MODE. Other configuration modes are not applicable. $1 > 50 and $1 <= 75 Indicates that in a data aggregate, the condition is met if the data values in row 1 is greater than 50 and equal to or smaller than 75. Then the data aggregate that meets the condition is returned. NOTE For a combined condition, the keywords must refer to the same range. A condition like $1 > 50 and $2 <= 75, where the first keyword refers to row 1 and the second row 2, is invalid. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-235 M2000 iSStar User Guide 5 HFC Library Reference Conditional Expression Meaning :$1 > 50 and :$1 <= 75 Indicates that in a data aggregate, the condition is met if the data values in column 1 are greater than 50 and equal to or smaller than 75. Then the data aggregate that meets the condition is returned. NOTE l For a combined condition, the keywords must refer to the same range. A condition like :$1 > 50 and :$2 <= 75, where the first keyword refers to column 1 and the second column 2, is invalid. l For a combined condition, the expressions must not contradict each other. That is, the expression type must be the same, for example, all the expressions are led by $, :$, or $X:$Y. $1 > 50 and :$2 <= 75 is an invalid expression. Indicates that in a data aggregate, the condition is met if the data in a placement is error. The data aggregate that meets the condition is returned. $$ == '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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Note Before calling this function, call Function: NewReport to create a report object, call Function: AddSheet to create a sheet, and call Function: AddTable to create a table. Parameter Description Parameter Parameter Description TableHandle TableHandle is a long integer. It indicates the return value of the Function: AddTable function. Row Row is an integer. It indicates the row position. Row number begins from 0. Col Col is an integer. It indicates the column position. The column number begins from 0. Value Value is a string. It indicates the cell contents. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-237 M2000 iSStar User Guide 5 HFC Library Reference Note l Before this function is called, you should call Function: NewReport to create a report, call Function: AddSheet to add a sheet, call Function: AddTable to add a table, and call Function: AddRange to get a range. l If the cells are set to merge when you create the range, this function sets the display contents of the merged range. l If the cells are not set to merger when you create the range, this function sets the display contents of each cell in the range. Parameter Description Parameter Description RangeHandle RangeHandle is a long integer and refers to an area object. It indicates the return value of called AddRange Function. Value Value is a string. It indicates the range 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Note l Before calling the SetTableValueEx function, you need to call the NewReport function. l This function supports a maximum of 10 conditional expressions. Only the first 10 conditional expressions can be set successfully if more than 10 expressions are created. l When the function is called, the rows or columns that are beyond the settings of TbData are truncated. Parameter Description Parameter Description TableHandle TableHandle is an integer. It indicates a table object. TbData TbData is of two-dimensional list type. It indicates the data to be added to a table. If a conditional expression is specified, tbData refers to the object of the conditional expression. Exps Exps is a conditional express list. Each element in the list is the conditional expression object of the Selector function. Return Value The return value is an integer. If the data is successfully added to the table, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example #Create a two-dimensional list. data = [['Name', 'English', 'Maths', 'History', 'Chinese']] data.append(['Jacky', 65, 79, 56, 85]) data.append(['Tommy', 85, 70, 87, 90]) data.append(['Marry', 46, 56, 59, 85]) data.append(['Rob', 85, 80, 87, 74]) data.append(['Jenny', 90, 75, 67, 65]) NewReport() sId = AddSheet('school report card') tId = AddTable(sId, len(data), len(data[0])) rId = AddRange(tId, 0, 0, 0, len(data[0])-1 ) SetRangeBGColor(rId, Teal) #Set the 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-239 M2000 iSStar User Guide 5 HFC Library Reference Result A file report.xls is created,As follows Related Example Function: SetTableValue This describes the SetTableValue function. This function enables you to set the contents of the cells in a table. Synopsis SetTableValue(TableHandle, ValueList) Note l For a table with m rows and n columns, set contents of the cells in the sequence of (0,0), (0, 1)...(0,n),(1,0),(1,1)...(1,n),(m,0),(m,1)...(m,n). l If a cell is actually a range merged by multiple cells, set the range value to the value of the first cell in the range. l Before calling this function, call Function: NewReport to create a report object, call Function: AddSheet to create a sheet, and call Function: AddTable to create a table. Parameter Description Parameter Description TableHandle TableHandle is a long integer. It indicates the return value of the Function: AddTable function. ValueList ValueList is of list type. The elements in the list are strings which indicate the values of the cells in the table. Return Value The return value is an integer. If the contents of the cells in the table is set successfully, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. 5-240 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 Name of a sheet. This parameter is of string type. TableNo Number of a table. This parameter indicates the number of the table that needs to be updated in the specified sheet. This parameter is of integer type. The value ranges from 0. RowNo Number of a row. This parameter indicates the number of the row to be updated. This parameter is of integer type. The value ranges from 0. DataList This parameter is of string sequence type. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-241 M2000 iSStar User Guide 5 HFC Library Reference page1 = AddSheet("sheet1") table1 = AddTable(page1, 6, 8, "table1") valueList = [str(i) for i in range(6 * 8)] SetTableValue(table1, valueList) ret = UpdateRow("sheet1", 0, 1, ["Happy ","new ","year ! "]) SaveReportAs("result.xls") Related Example 5.12.3 Report Display Function This describes the report display function. This function enables you to define the display style of the a table, range, or cell. For example, you can define the background color, alignment mode, font, and column width. Function: ReportStyle Sets the cell display style. The display style of cells refers to the background color, alignment mode, and font. Synopsis ReportStyle([BgColor[,Align[,Font]]]) Note l All input parameters of this function have default values. If you do not specify the input parameters, the default display style is white background and centered. l Before calling the ReportStyle function, you need to call the NewReport function. Parameter Description Parameter 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 Align is a character. It indicates the content alignment type within the range. The optional values are as follows: l L or I l C or c l R or r The default value is L. Parameter: Type describes the meanings of Align. 5-242 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Font Description Font is of tuple type. It contains four elements, that is, type, size, color, and bold. l Type is an integer. It indicates the font type. The optional value ranges from 0 to 8. For details of the meanings of type, refer to Parameter: FontType. l Size is an integer. It indicates the font size. The value ranges from 7 to 36 pounds. l Color is an integer. It indicates the background color. The value ranges from 0 to 39. To know the meaning of color, refer to Parameter: Color. l Bold is an integer. It indicates whether fonts are in bold. – The value 1 means that the fonts are in bold. – The value 0 means that the fonts are displayed in normal conditions. Return Value The return value is an integer. If the display style of cells is created, a value greater than 0 is returned. Otherwise, -1 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example style = ReportStyle(Light_Orange, 'C') exp1 = Selector(':$1 > 50 and :$1 <= 75', style, ROW_MODE) Related Example Function: SetCellAlign This describes the SetCellAlign function. This function enables you to set the alignment type of a cell. Synopsis SetCellAlign(TableHandle, Row, Col[, Type]) Note Before this function is called, you should call Function: AddTable to create a table. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-243 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Parameter Description TableHandle TableHandle is a long integer. It indicates Handle of the table (the unique identifier of the table). Row Row is an integer. It indicates the row position. Row number begins from 0. Col Col is an integer. It indicates the column position. The column number begins from 0. Type Type is a character. It indicates the content align type within the range. The optional values are as follows: l L l C l R l l l c l r For detailed meanings of Type, refer to Parameter: Type. The default value is L. Return Value The return value is an integer. If the alignment type of the cell is set successfully, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") table1 = AddTable(page1, 6, 8) valueList = [str(i) for i in range(6 * 8)] SetTableValue(table1, valueList) #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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Related Example Function: SetCellBGColor This describes the SetCellBGColor function. This function enables you to set the background color of a cell. Synopsis SetCellBGColor(TableHandle, Row, Col, Color) Note Before this function is called, you should call Function: AddTable to create a table. Parameter Description Parameter Parameter Description TableHandle TableHandle is a long integer. It indicates Handle of the table (the unique identifier of the table). Row Row is an integer. It indicates the row position. Row number begins from 0. Col Col is an integer. It indicates the column position. The column number begins from 0. Color Color is an integer. It indicates the background color. The optional values of Color range from 0 to 39. To know the meaning of Color, refer to Parameter: Color. Return Value The return value is an integer. If the background color of the cell is set successfully, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") table1 = AddTable(page1, 6, 8) valueList = [str(i) for i in range(6 * 8)] resultCode = SetTableValue(table1, valueList) resultcode = SetCellBGColor(table1, 3, 3, Teal) SaveReportAs("example.xls") Related Example Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-245 M2000 iSStar User Guide 5 HFC Library Reference Function: SetCellFont This describes the SetCellFont function. This function enables you to set the font, size, color, bold of a cell. Synopsis SetCellFont(TableHandle, Row, Col, FontType[, FontSize[,Color[, bBold]]]) Note Before calling this function, call Function: NewReport to create a report object, call Function: AddSheet to create a sheet, and call Function: AddTable to create a table. Parameter Description Parameter Parameter Description TableHandle TableHandle is a long integer. It indicates Handle of the table (the unique identifier of the table). Row Row is an integer. It indicates the row position. Row number begins from 0. Col Col is an integer. It indicates the column position. The column number begins from 0. FontType FontType is an integer. It indicates the font type. The optional value starts from 0 to 8. For detailed meanings of the values of FontType, refer to Parameter: FontType. FontSize FontSize is an integer. It indicates the font size. The value ranges from 7 to 36 pounds. The default value is 9 pounds. Color Color is an integer. It indicates the background color. The optional values range from 0 to 39. The default value is 0, which indicates black. For details of the optional values for Color, refer to Parameter: Color. bBold bBold is of Boolean type. It indicates whether fonts are in bold. l The value 1 means that the fonts are in bold. l The value 0 means that the fonts are displayed in normal conditions. The default value is 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") table1 = AddTable(page1, 8, 10, "table1") SetCellValue(table1, 6, 7, "cellvalue") #Set the font of the cell in row 6 and column 7 in table1 to Arial, 10 pounds, and bold. resultcode = SetCellFont(table1, 6, 7, 0, 10, 19, 1) SaveReportAs("example.xls") Related Example Function: SetColumnWidth This describes the SetColumnWidth function. This function enables you to set the width of the specified column in a sheet. Synopsis SetColumnWidth(SheetHandle, Col[, Width]) Note l The setting for column width of the page is only valid for files in .xls format. l Before this function is called, you should call Function: NewReport to create a report and call Function: AddSheet to create a sheet. Parameter Description Parameter Description SheetHandle TableHandle is a long integer. It indicates Handle of the table (the unique identifier of the table). Col Col is an integer. It indicates the column position. The column number begins from 0. Width Width is an integer. It indicates a multiple of default column width. The default value is 1. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-247 M2000 iSStar User Guide 5 HFC Library Reference Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") for row in range(4) ret = SetColumnWidth(page1, row, 2 ) end SaveReportAs("example.xls") Related Example Function: SetRangeAlign This describes the SetRangeAlign function. This function enables you to set the content alignment type of the specified range. Synopsis SetRangeAlign(RangeHandle[, Type]) Note l For a range whose cells are not set to merge when being created, this function sets the alignment mode of all the cells in the range. l Before this function is called, you should call Function: AddRange to create an area. Parameter Description Parameter Description RangeHandle RangeHandle is a long integer. It indicates Handle of the range (the unique identifier of the range). Type Type is a string. It indicates the content alignment type. The optional values are as follows: l L l C l R l l l c l r For detailed meanings of the values of Type, refer to Parameter: Type. The default value is L. 5-248 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Return Value The return value is an integer. If the alignment type of the specified range is set successfully, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") table1 = AddTable(page1, 6, 8) range1 = AddRange(table1, 1, 2, 3, 5, 1) SetRangeValue(range1,'right') resultcode = SetRangeAlign(range1, "R") SaveReportAs("example.xls") Related Example Function: SetRangeBGColor This describes the SetRangeBGColor. This function enables you to set the background color of the specified range. Synopsis SetRangeBGColor(RangeHandle, Color) Note l For a range whose cells are not set to merge when being created, this function sets the background color of all the cells in the range. l Before this function is called, you should call Function: AddRange to create an area. Parameter Description Parameter Description RangeHandle RangeHandle is a long integer. It indicates Handle of the range (the unique identifier of the range). Color Color is an integer. It indicates the background color. Its value ranges from 0 to 39. For details of the optional values for Color, refer to Parameter: Color. Return Value The return value is an integer. If the background color of the range is set successfully, 1 is returned. Otherwise, 0 is returned. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-249 M2000 iSStar User Guide 5 HFC Library Reference Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") table1 = AddTable(page1, 6, 8) range1 = AddRange(table1, 1, 2, 3, 5, 1) resultcode = SetRangeBGColor(range1, Blue) SaveReportAs("example.xls") Related Example Function: SetRangeFont This describes the function SetRangeFont function. This function enables you to set the type, size, color, bold of a range in a table. Synopsis SetRangeFont(RangeHandle, FontType[, FontSize[, Color[, bBold]]]) Note l For the range whose cells are not set to merge when being created, this function sets the font of all the cells in the range. l Before this function is called, you should call Function: NewReport to create a report, call Function: AddSheet to add a sheet, call Function: AddTable to add a table, and call Function: AddRange to get a range. Parameter Description Parameter Parameter Description RangeHandle RangeHandle is a long integer. It indicates Handle of the range (the unique identifier of the range). FontType FontType is an integer. It indicates the font type. The optional value starts from 0 to 8. To know the meaning of FontType, refer to Parameter: FontType. FontSize FontSize is an integer. It indicates the font size. The value ranges from 7 to 36 pounds. The default value is 9 pounds by default. Color Color is an integer. It indicates the background color. The optional values range from 0 to 39. The default value is 0, which indicates black. To know the meaning of Color, refer to Parameter: Color. 5-250 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter bBold Parameter Description bBold is of Boolean type. It indicates whether fonts are in bold. l The value 1 means that the fonts are in bold. l The value 0 means that the fonts are displayed in normal conditions. The default value is 0. Return Value The return value is an integer. If the function is called successfully, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") table1 = AddTable(page1, 6, 8) range1 = AddRange(table1, 1, 2, 3, 5, 1) SetRangeValue(range1, "SetRangeFont") #Set the font of the range to Arial, 9 pounds, red, and not bold. resultcode = SetRangeFont(range1, 0, 9, 16, 0) SaveReportAs("exa09.xls") Related Example Function: SetTableBGColor This describes the SetTableBGColor. This function enables you to set the background color of a table. Synopsis SetTableBGColor(TableHandle, Color) Note l This function re-defines the background color of the cells and ranges in the table. l Before calling this function, call Function: NewReport to create a report object, call Function: AddSheet to create a sheet, and call Function: AddTable to create a table. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-251 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description TableHandle TableHandle is a long integer. It indicates Handle of the table (the unique identifier of the table). Color Color is an integer. It indicates the background color. Its value ranges from 0 to 39. The default value is 39, representing white. For details of the optional values for Color, refer to Parameter: Color. Return Value The return value is an integer. If the background color of the table is set successfully, 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("Page1") table1 = AddTable(page1, 6, 8, "Table1") #Set the background color of the cell in row 3 and column 5 in table1 to yellow. resultcode = SetCellBGColor(table1, 3, 5, 26) SaveReportAs("example.xls") Related Example Function: SetTableFont This describes the SetTableFont function. This function enables you to set the table font. Synopsis SetTableFont(TableHandle, FontType[, FontSize[, Color[, bBold]]]) Note Before calling this function, call Function: NewReport to create a report object, call Function: AddSheet to create a sheet, and call Function: AddTable to create a table. 5-252 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description TableHandle TableHandle is a long integer. It indicates the return value of the Function: AddTable function. FontType FontType is an integer. It indicates the font type. The optional value ranges from 0 to 8. For detailed meaning of the FontType parameter refer to Parameter: FontType. FontSize FontSize is an integer. It indicates the font size. The value ranges from 7 to 36 pounds. The default value is 9 pounds by default. Color Color is an integer. It indicates the background color. The values ranges from 0 to 39. The default value is 0, which indicates black. For detailed meaning of the Color parameter, refer to Parameter: Color. bBold bBold is an integer. It indicates whether fonts are in bold. l The value 1 means that the fonts are in bold. l The value 0 means that the fonts are displayed in normal conditions. The default value is 0. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-253 M2000 iSStar User Guide 5 HFC Library Reference 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 TableHandle is a long integer. It indicates Handle of the table (the unique identifier of the table). FontType FontType is an integer. It indicates the font type. The optional value ranges from 0 to 8. To know the meaning of FontType, refer to Parameter: FontType. FontSize FontSize is an integer. It indicates the font size. The value ranges from 7 to 36 pounds. The default value is 9 pounds by default. Color Color is an integer. It indicates the background color. The value ranges from 0 to 39. The default value is 0, which indicates black. For detailed meaning of the Color parameter, refer to Parameter: Color. bBold bBold is an integer. It indicates whether fonts are in bold. l The value 1 means that the fonts are in bold. l The value 0 means that the fonts are displayed in normal conditions. The default value is 0. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.12.4 Report Management Function This describes the report management function. This function enables you to import, create, and save report files, and export report model files. 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 FilePath is of string type. It indicates the full path of the imported model file. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-255 M2000 iSStar User Guide 5 HFC Library Reference SaveReportAs("oldfile.xls") StoreReport("c:/storefile.dat") ret = LoadReport("c:/storefile.dat") RemoveRow("Page1", 0, 0) SaveReportAs("newfile.xls") Related Example Function: NewReport This describes the NewReport function. This function enables you to create a report. Synopsis NewReport() Note l During the report operation, this function must be called before it is called by other report operations. l For one task, NewReport can be called only once. If the NewReport() interface is invoked again, all the previous report operations are deleted. Parameter Description None Return Value The return value is an integer. If the report is created successfully, the value 1 is returned. Otherwise, 0 is returned. Error Handling Obtain the error information by using the 5.10.2 Function: GetLastError and the 5.10.3 Function: GetErrorMsg functions. Example NewReport() page1 = AddSheet("page1") SaveReportAs("exa08.xls") Related Example Function: SaveReportAs This describes the SaveReportAs function. This function enables you to save the created report file. Synopsis SaveReportAs(FilePath) 5-256 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Note l The save path does not support the network path format. l If the same file name exists in the specified directory, an extension .bak is added to the file name, and then the system saves the created file. l Before the function is called, call Function: NewReport to create a report. Parameter Description Parameter 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-257 M2000 iSStar User Guide 5 HFC Library Reference Figure 5-8 Procedure for modifying a report Synopsis StoreReport(filePath) Note None Parameter Description Parameter Description filePath filePath is of string type. It indicates the save path of the model file. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.12.5 Parameters for Operating Report This describes the values and meanings of the report operation parameters. The parameters are Color, FontType, and Type. 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 Table 5-25 Meanings of optional colors Value Meaning 0 Black 1 Brown 2 Olive_Green 3 Dark_Green 4 Dark_Teal 5 Dark_Blue 6 Indigo 7 Gray80 8 Dark_Red 9 Orange Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-259 M2000 iSStar User Guide 5 HFC Library Reference 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 l Size: 9 pounds l Color: Black l Bold: No Table 5-26 Description of optional font values Value Meaning 0 Arial 1 Courier New Sample 2 3 4 5 Century 6 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-261 M2000 iSStar User Guide 5 HFC Library Reference Table 5-27 Type Description Format Meaning ‘L',‘l' The content alignment format is align left. ‘C',‘c' The content alignment format is align center. ‘R',‘r' The content alignment format is align right. 5.12.6 Examples of Report Operation Function This gives the examples of the report operation function. You can better understand how to use report operation functions to perform routine maintenance. Example #create a report object NewReport() Call("cell_sample.hsl") Call("color_sample.hsl") Call("font_sample.hsl") Call("Align_sample.hsl") #save report SaveReportAs("d:/reportSample.xls") SaveReportAs("d:/reportSample.html") cell_sample.hsl #create new sheet named“color” page = AddSheet("Edit Table") table1 = AddTable(page, 6, 8, "Modify single cell") table2 = AddTable(page, 6, 8, "Modify cells in range") table3 = AddTable(page, 6, 8, "Fill table with list") #########set a single cell's value###### SetCellValue(table1, 0, 0, "hello") ########set several at one time########## rowFrom = 2 colFrom = 2 rowTo = 3 colTo = 3 range = AddRange(table2, rowFrom, colFrom, rowTo, colTo) SetRangeValue(range, "hello") #########fill table with list################# valueList = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U SetTableValue(table3, valueList) # # # # # AddSheet(sheetname) AddTable(SheetHandle, row, col, tablename) SetCellValue(TableHandle, row, col, pszValue) SetRangeValue(RangeHandle, pszValue) SetTableValue(TableHandle, list) color_sample.hsl #create new sheet named“color” page1 = AddSheet("color") table1 = AddTable(page1, 6, 8, "color sample") table2 = AddTable(page1, 25, 8, "Edit table color") 5-262 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference ########### set "color sample" table################### def setCellColor(row, col, colorIndex) cell = AddRange(table1, row, col, row, col, 1) if cell SetRangeBGColor(cell, colorIndex) else Print("cell is not found") end end colorIndex = 0; for row in range(6) for col in range(8) setCellColor(row, col, colorIndex) colorIndex = colorIndex + 1 end end ########### set "Edit table color" table################### range1 = AddRange(table2, 1, 0, 7, 7) range2 = AddRange(table2, 8, 0, 9, 7) range3 = AddRange(table2, 10, 0, 13, 7) range4 = AddRange(table2, 14, 0, 20, 7) range5 = AddRange(table2, 21, 0, 24, 7) range6 = AddRange(table2, 1, 5, 3, 7) range7 = AddRange(table2, 1, 6, 2, 7) Color0 = 15 Color1 = 37 Color2 = 38 Color3 = 31 Color4 = 37 Color5 = 36 Color6 = 29 Color7 = 21 Color8 = 13 SetTableBGColor(table2, Color0) SetRangeBGColor(range1, Color1) SetRangeBGColor(range2, Color2) SetRangeBGColor(range3, Color3) SetRangeBGColor(range4, Color4) SetRangeBGColor(range5, Color5) SetRangeBGColor(range6, Color6) SetRangeBGColor(range7, Color7) SetCellBGColor(table2, 1, 7,Color8) #AddRange(TableHandle, rowFrom, colFrom, rowTo, colTo[, bMerged]) #SetRangeBGColor(RangeHandle, Color) #SetCellBGColor(TableHandle, row, col,Color) font_sample.hsl #1 create new sheet named "font" page = AddSheet("font") #2 create a table table = AddTable(page, 5, 6, "font") #3 set table header range1 = AddRange(table, 0, 0, 4, 5) SetRangeValue(range1, "Hello world") valueList = ['Font','Normal','Size 15','Size 25','Color','Bold'] SetTableValue(table, valueList) SetCellValue(table, 1, 0, "Arial") SetCellValue(table, 2, 0, "Courier New") SetCellValue(table, 3, 0, "Century") SetCellValue(table, 4, 0, "MS Gothic") #4 basic font sample defaultSize = 15 defaultColor = 0 red = 16 bold = 1 def setRowFont(row,font) SetCellFont(table, row, 1, font) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-263 M2000 iSStar User Guide 5 HFC Library Reference SetCellFont(table, row, 2, SetCellFont(table, row, 3, SetCellFont(table, row, 4, SetCellFont(table, row, 5, end fontList = [0,1,5,6] for row in range(1,5) font = fontList[row - 1] setRowFont(row,font) end 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") 5.13 Directory Operation Function This section describes the operation functions related to the files and directories. 5.13.1 Overview of Directory Operation Function The iSStar provides the directory operation functions to operate files and directories. 5.13.2 Function: Open This function enables you to open the file in a specified mode. After the file is successfully opened, you can obtain a file operation ID of unsigned integer. Through the file operation ID, you can have the rights of operating the files through the read, write, and close functions. 5.13.3 Function: read This function enables you to read the data from the opened file. 5.13.4 Function: write 5-264 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. 5.13.1 Overview of Directory Operation Function The iSStar provides the directory operation functions to operate files and directories. The directory operation functions enable you to do the following operations: l Create and delete a specified directory. l Open a file to read and write. l Delete a specified file. l Change the file name. The directory operation functions provided by the iSStar are listed in Table 5-28. Table 5-28 List of directory operation functions Function Description 5.13.2 Function: Open This function enables you to open the file in a specified mode. 5.13.3 Function: read This function enables you to read the data from the opened file. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-265 M2000 iSStar User Guide 5 HFC Library Reference Function Description 5.13.4 Function: write This function enables yo to write the data to 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. Ensure that the parent directory exists. 5.13.7 Function: RmDir This function enables you to delete a specified directory. 5.13.8 Function: GetCwd This function enables you to display get the existing path. 5.13.9 Function: Remove This function enables you to delete a 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 directory. 5.13.12 Function: MakeDirs This function enables you to create directories recursively. 5.13.13 Function: RemoveDirs This function enables you to delete the specified directories recursively. 5.13.2 Function: Open This function enables you to open the file in a specified mode. After the file is successfully opened, you can obtain a file operation ID of unsigned integer. Through the file operation ID, you can have the rights of operating the files through the read, write, and close functions. Synopsis Open(filename[,mode]) Note 5-266 l When the file is opened in a 'w' or 'w+' mode, the original data in the file is overwritten when you perform the write operation. l When the file is opened in an 'a' or 'a+' mode, the content to be written is added to the end of the file when you perform the write operation. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Name filename Description The file to be opened. The modes for opening the file are as follows: mode l 'r' indicates the read mode. The opened file is used for reading. l 'w' indicates the write mode. In this mode, the file can be cleared. l 'a' indicates the append mode. l 'r+' indicates the read and write mode. l 'w+' indicates the read and write mode. In this mode, the file can be cleared. l '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 not support reading and writing operations at the same time. l In the 'r+' mode, you can write the data at the beginning of the file. The content of the file is overwritten partially. Therefore, illegible characters may occur after you write the data into the file. l In the 'w', 'a', 'w+', 'a+' mode, if the file to be opened does not exist, the file is created. Return Value In case of success, the file operation ID is returned. Otherwise, an exception occurs. Error Handling If the specified file does not exist when you open the file in a read mode, the program throws an exception that the specified file does not exist. 5.13.3 Function: read This function enables you to read the data from the opened file. Synopsis File_object.read(size=MAXSIZE) Note l Issue 01 (2008–12–08) 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 5 HFC Library Reference l If the length of the data needed to be read exceeds the maximum, you need to read all the data of the file. Parameter Description Parameter 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) #Assmue that the content of the Hello.txt file is 12345. Results 12345 5.13.4 Function: write This function enables you to write the data into the opened file. Synopsis File_object.write(str) Note 5-268 l When using the Write function, you need to open the existing file in a read mode through the Open function. l When the file is opened in a 'w'or 'w+'mode, the written data overwrites the original data of the file. When the file is opened in an 'a'or 'a+'mode, the written data is appended to the end of the file. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Name Description str The string to be written. 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 5.13.5 Function: close This function enables you to close the opened file. Synopsis File_object.close() Note None. Parameter Description None. Return Value None. Error Handling None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-269 M2000 iSStar User Guide 5 HFC Library Reference Example fp = Open("d:\\Hello.txt") fp.close() 5.13.6 Function: MkDir This function enables you to create a directory. You must ensure that the parent directory exists. 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 5.13.7 Function: RmDir This function enables you to delete the specified directory. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.13.8 Function: GetCwd This function is used to display the current working path. 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 5.13.9 Function: Remove This function enables you to delete the specified file. Synopsis Remove(filename) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-271 M2000 iSStar User Guide 5 HFC Library Reference Note l The file name represented by the filename parameter must exist and allows to be deleted. l If the file to be deleted is being used, then the file fails to be deleted. Parameter Description Parameter Description filename is a string. It indicates the file to be removed, which may contain the path (the default path is the current path). filename It supports Windows-style file path (containing \\) and Unix-style file path (containing /). Return Value The return value is of Boolean. If the function is called successfully, True is returned. Otherwise, False is returned. Error Handling None. Related Examples 5.13.10 Function: Rename This function enables you to change the name of a file or directory. Synopsis Rename(Src,Dst) Note l The Src file must exist and allows to be accessed and modified. l Dst must ensure that the name of a file or directory is unique. If the name of a file or directory is the same as another name, then the rename operation fails. l Scr and Dst must ensure that the rename operation is in accordance with the rule for naming a file name on the current operating system. Parameter Description Parameter 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 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.13.11 Function: ListDir This function lists all the files in the specified folder. Synopsis ListDir(Path) Note l The directory specified by Path must be available. l Files are arranged in the alphabetic order and do not display the symbols "." and ".." in the file directory. Parameter Description Parameter 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-273 M2000 iSStar User Guide 5 HFC Library Reference 5.13.12 Function: MakeDirs This function enables you to create directories recursively, such as, creating all the intermediatelevel directories (including the lead directory). 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 5.13.13 Function: RemoveDirs This function enables you to recursively remove the specified directories. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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 5.13.14 Examples of Directory Operation Function This section describes how to use the directory operation function through the following example. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-275 M2000 iSStar User Guide 5 HFC Library Reference 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.14.1 Overview of GUI Interactive Library Function The iSStar provides the GUI Interactive library function. This function enables you to interact with the iSStar in the user-defined work area of the GUI interactive interface. 5.14.2 Introduction to GUI Interactive Library Controls 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, and checkbox control. 5.14.3 Function: CreateForm This function enables you to create a blank form. 5.14.4 Function: Label This function enables you to create a label control. The label control supports only the function of displaying the information. It does not provide the editing function. 5.14.5 Function: Edit This function enables you to create a single-line input control. 5.14.6 Function: CheckBox This function enables you to create a check box control. 5.14.7 Function: RadioBoxGroup This function enables you to create a radio control. 5.14.8 Function: Enter This function enables you to create a feed line control. Feed line controls are used to adjust the layout of an interface. They do not support the input and display functions. The controls of a form can be orderly arranged. You can use a feed line control to locate controls on a new line. 5.14.9 Function: Space This function enables you to create a placeholder control. This control is used to adjust the horizontal locations of the controls. 5.14.10 Function: ShowForm This function is used to display a new form on the task window. 5.14.11 Function: GetValue This function enables you to obtain the input on controls. 5.14.12 Function: DeleteForm This function enables you to delete unrequired forms for releasing resources. 5.14.13 Examples of GUI Interactive Library Function This section gives some examples to describe how to use GUI interactive library functions. 5.14.1 Overview of GUI Interactive Library Function The iSStar provides the GUI Interactive library function. This function enables you to interact with the iSStar in the user-defined work area of the GUI interactive interface. 5-276 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference l The iSStar provides the work area for GUI interactive interface (It is short for form). This function enables you to input multiple pieces of information on the task once through the form. l This function allows you to customize the form to display the user-defined controls. The GUI interactive components are placed in the form. This work area is integrated in the task running window. l The form view is hidden by default. The GUI interactive library, however, provides the function for displaying the form. If the function for displaying the form is called, the form view is displayed. After the form is submitted and the interaction is complete, the form is hidden automatically. l The GUI interactive library provides multiple controls to support the function of service interaction. The controls include the single-line input control, password control, radio control, checkbox control, and NE display control. The iSStar can automatically lay out the controls on a form view. In addition, you can also adjust the layout flexibly and easily. For details, see 5.14.2 Introduction to GUI Interactive Library Controls. NOTE The GUI functions are provided for the locals tasks; therefore, these functions cannot be called when you perform the remote tasks. The GUI interactive library functions provided by the iSStar are listed in Table 5-29. Table 5-29 List of GUI interactive library functions Function Description 5.14.3 Function: CreateForm This function enables you to create a blank form. 5.14.4 Function: Label This function enables you to create a label. 5.14.5 Function: Edit This function enables you to create a singleline input control. 5.14.6 Function: CheckBox This function enables you to create a checkbox control. 5.14.7 Function: RadioBoxGroup This function enables you to create a radio control. 5.14.8 Function: Enter This function enables you to create a feed line control. 5.14.9 Function: Space This function enables you to create a placeholder control. 5.14.10 Function: ShowForm This function is used to display a new form on the task window. 5.14.11 Function: GetValue This function enables you to obtain the input information on controls. 5.14.12 Function: DeleteForm This function enables you to delete unnecessary forms. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-277 M2000 iSStar User Guide 5 HFC Library Reference 5.14.13 Examples of GUI Interactive Library Function shows examples of creating a GUI interactive interface. The procedure is as follows: 1. Create a blank form. For details, see 5.14.3 Function: CreateForm. 2. Create and customize the controls provided by the library. Then, add the controls to the form. For details, see 5.14.2 Introduction to GUI Interactive Library Controls. 3. Adjust the layout of the controls. For details, see 5.14.2 Introduction to GUI Interactive Library Controls. 4. Call the function for displaying the form. The form controls are displayed. For details, see 5.14.10 Function: ShowForm. 5. After interaction, obtain the input information on the interactive interface. For details, see 5.14.11 Function: GetValue. 6. Remove the form if required. For details, see 5.14.12 Function: DeleteForm. 5.14.2 Introduction to GUI Interactive Library Controls 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, and checkbox control. Introduction to the GUI Interactive Library Controls For details of GUI interactive library functions, see Table 5-30. Table 5-30 GUI interactive library controls Function Description 5.14.4 Function: Label Create a label 5.14.5 Function: Edit Create a single-line input control 5.14.6 Function: CheckBox Create a checkbox control 5.14.7 Function: RadioBoxGroup Create a radio control Control Preview , Introduction to the Layout of the GUI Interactive Library Controls For basic concepts involved in the layout of GUI interactive library controls and the details on how to adjust the layout by using auxiliary controls, see Table 5-31. 5-278 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Table 5-31 Layout of the controls Concept Description Composition of a form view A form view consists of title area, control area, and button area, as shown in the following figure. Layout of the controls in the control area l Title area: Located on the top of a form view. This area displays the title of the form. The contents of the title area are customized when you create the form. l Control area: This area displays the custom controls, such as ratio controls and input controls. This area is located in the middle of a form view. l Button area: This area displays the buttons in a form view. You can customize the number of buttons and the characters over the buttons. For details, see 5.14.3 Function: CreateForm. The controls are arranged horizontally, that is, the controls are arranged from left to right according to the sequence of creation time, as shown in the following figure. The script is as follows: form1 = CreateForm("Layout Sample",["send", "cancel"]) Label(form1,100, "label1") Label(form1,100, "label2") Label(form1,100, "label3") ShowForm(form1) Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-279 M2000 iSStar User Guide 5 HFC Library Reference Concept Description Usage of auxiliary layout controls Auxiliary layout controls are used to adjust the layout of the interface. Two types are available, that is, placeholder control and line feed control. l Placeholder control: used to adjust the horizontal location of the controls in a line. The control does not display any character. l Line feed control: used to adjust the vertical location of the controls. All the controls after a line feed character are displayed in a new line. The effect that uses the placeholder control is shown in the following figure. The script is as follows: form1 = CreateForm("Layout Sample",["send", "cancel"]) Space(form1,100) Label(form1,100, "label1") Label(form1,100, "label2") Label(form1,100, "label3") ShowForm(form1) The effect that uses the line feed control is shown in the following figure. The script is as follows: form1 = CreateForm("Layout Sample",["send", "cancel"]) Label(form1,100, "label1") Enter(form1) Label(form1,100, "label2") Enter(form1) Label(form1,100, "label3") ShowForm(form1) 5.14.3 Function: CreateForm This function enables you to create a blank form. 5-280 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Synopsis CreateForm (title, buttonList) Precaution None. Parameter Description Parameter Description title title is of string type. It indicates the title of the form to be customized. buttonList buttonList is of string list type. It indicates the button list of the form to be customized. The created buttons are displayed on the bottom of the form. The function of the buttons is to check whether the interaction is performed. The form is automatically hidden after the interaction is complete. 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) 5.14.4 Function: Label This function enables you to create a label control. The label control supports only the function of displaying the information. It does not provide the editing function. Synopsis Label(formId, width, text) Note The height of the control is twenty-one pixels and cannot be set. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-281 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description Parameter Description formId formId is of integer type. It indicates the ID of a form object. width It indicates the width of a control. The unit is pixel. text It indicates the text information displayed on the Label control. This parameter is of string type. 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) 5.14.5 Function: Edit This function enables you to create a single-line input control. 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 formId is of integer type. It indicates the ID of a form object. width It indicates the width of the Edit control text It indicates the text information displayed on the Edit control. The text information is null by default. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description bPwd It is used to define whether a password is required for the Edit control If it is set to True, you need to create a text input control of password type. By default, this parameter is set to False. 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) 5.14.6 Function: CheckBox This function enables you to create a check box control. Synopsis CheckBox(formId, width, caption, selected = False) Note The height of the control is fixed and cannot be set. Description Parameter Description formId formId is of integer type. It indicates the ID of a form object. width It indicates the width of the check box control. The unit is pixel. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-283 M2000 iSStar User Guide 5 HFC Library Reference Parameter Description caption It indicates the caption displayed on the option. This parameter is of string type. selected It is used to set the initial selected status of the option control. The value can be True or False. The default value is False. l True: indicates that the control is automatically selected after being created. l False: indicates that the control is automatically deselected after being created. 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) 5.14.7 Function: RadioBoxGroup This function enables you to create a radio control. 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 formId is of integer type. It indicates the ID of a form object. width It indicates the width of a control. The unit is pixel. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Parameter Description choices It indicates the content of each radio box. This parameter is of string list type. caption It indicates the caption displayed on the control. This parameter is of string type. dimension It is used to set the column number that the radio controls are displayed. 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) 5.14.8 Function: Enter This function enables you to create a feed line control. Feed line controls are used to adjust the layout of an interface. They do not support the input and display functions. The controls of a form can be orderly arranged. You can use a feed line control to locate controls on a new line. Synopsis Enter(formId) Note None. Parameter Description Parameter Description formId formId is of integer type. It indicates the ID of a form object. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-285 M2000 iSStar User Guide 5 HFC Library Reference 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) 5.14.9 Function: Space This function enables you to create a placeholder control. This control is used to adjust the horizontal locations of the controls. Synopsis space(formId, width) Note The height of the control is twenty-one pixels and cannot be set. Parameter Description Parameter Description formId formId is of integer type. It indicates the ID of a form object. width It indicates the width of the placeholder control. The unit is pixel. 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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) 5.14.10 Function: ShowForm This function is used to display a new form on the task window. Synopsis ShowForm (formId) Note l A form is not automatically displayed after you call the CreateForm function. You need to call the ShowForm function in the script to display the created form. l For a task that does not support the interaction with the GUI, calling the ShowForm function leads to the termination of the task. Parameter Description Parameter Description formId It indicates the ID of a form object, that is, the value returned after you call the CreateForm function. This parameter is of integer type. Return Value After you call the ShowForm function, the script continues to be executed until you complete the interaction operation in the form. The return value is the text displayed on the button that indicates the completion in the form. For example, in the form, click Continue to complete the interaction. The return value of the ShowForm function is Continue. l If the formId entered in the ShowForm function is invalid, for example, no form is corresponding to the formId, the return value of the ShowForm function is None. l If calling the ShowForm function fails, None is returned. Error Handling None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-287 M2000 iSStar User Guide 5 HFC Library Reference Example form1 = CreateForm(" Welcome !",["Confirm"]) ShowForm(form1) DeleteForm(form1) 5.14.11 Function: GetValue This function enables you to obtain the input on controls. Synopsis GetValue(componentId) Note l You can call this function only after it is displayed in the home form and the interaction is complete. l The return value is None if you call this function to obtain the input information before the controls are displayed. l The GetValue function is applicable to only the controls that support the input function. For the controls that do not support the input function, such as the Space and Label controls, the return value is None. Parameter Description Parameter Description componentId It indicates the ID assigned to a created control. This parameter is of integer type. 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 It is used to return the input information on a text control. The return value is of string type. input CheckBox It is used to return whether the control is selected. If the control is selected, True is returned. Otherwise, False is returned. True or False Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Control Type Return Value Example RadioBoxGroup It is used to return the number of the selected option in the radio control group. The number is an integer ranging from 0. 1 If no option is selected, None is returned. Other types For the controls that do not support the input function, None is returned. None Error Handling None. 5.14.12 Function: DeleteForm This function enables you to delete unrequired forms for releasing resources. 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 formId is of integer type. It indicates the ID of a form object. Return Value None. Error Handling None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-289 M2000 iSStar User Guide 5 HFC Library Reference Example form1 = CreateForm(" Welcome !",["Confirm"]) ShowForm(form1) DeleteForm(form1) 5.14.13 Examples of GUI Interactive Library Function This section gives some examples to describe how to use GUI interactive library functions. 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.15 Task Management Function The task management functions are the operation functions related to the task. 5.15.1 Overview of Task Management Function 5-290 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. 5.15.1 Overview of Task Management Function 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. A task is a process in which a group of related script files are executed. The scripts in the task are run in serial mode. If these scripts need to call other scripts when the task is running and these called scripts are not associated, you can call the task management function to create sub tasks for concurrently running these called scripts, improving the execution efficiency. The task management functions provided by the iSStar are listed in Table 5-33. Table 5-33 List of task management functions Function Description 5.15.2 Function: CreateTask This function is used to create sub tasks for concurrently running other scripts required by the task. 5.15.3 Function: Wait This function is used to wait sub tasks 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. 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. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-291 M2000 iSStar User Guide 5 HFC Library Reference 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 kwargs is a dictionary. It is a user-defined parameter. It is used to enter the parameter value required when the filename script is running. 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. l taskid indicates the returned task ID when the sub task is created successfully. taskid is a string. Error Handling If an error occurs, you can obtain the error information through 5.10.2 Function: GetLastError and 5.10.2 Function: GetLastError. Example Print("This is main task.") for i in range(5) Print("In main task we create a subtask.") errorcode,taskid1 = CreateTask("task1.hsl") if (errorcode == 0) #If 0 is returned, it indicates that creating the sub task is successful Print("Subtask id is "+taskid1) #Print the ID of the sub task. Print("Invoke Wait interface.") Wait(taskid1) #Call the Wait function, wait until the sub task is executed, and continue end end 5.15.3 Function: Wait This function is used to wait for the sub task to be executed. 5-292 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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. 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. 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-293 M2000 iSStar User Guide 5 HFC Library Reference Error Handling None Example ret = GetRegisterKey('aa') Print(ret) Result None 5.15.5 Function: Exit This function is used to exit from the running script. 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("----------------") Create the main.hsl script whose content is: ret = Call("test.hsl") Print(".................") Print(ret) Run the main.hsl script. 5-294 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference Result hello ................. 16 5.16 Assertion Function Assertion functions are the operation functions related to assertion. 5.16.1 Overview of Assertion Function iSStarAssertion functions are used to diagnose expressions. 5.16.2 Function: Assert This function enables you to assert expressions. When the value of an expression is False, a running task is interrupted. 5.16.3 Function: Assert_ON This function enables you to turn on the switch of the Assert function and validate the Assert function. 5.16.4 Function: Assert_OFF This function enables you to turn off the switch of the Assert function and invalidate the Assert function. 5.16.1 Overview of Assertion Function iSStarAssertion functions are used to diagnose expressions. When the value of an expression is False, a running task is interrupted, and the exception information is output. Assertion functions provided in the iSStar are listed in Table 5-34. Table 5-34 List of assertion functions Function Description 5.16.2 Function: Assert This function is used to judge expressions. When the value of an expression is False, a running task is interrupted. 5.16.3 Function: Assert_ON This function is used to turn on the switch of the Assert function and validate the Assert function. 5.16.4 Function: Assert_OFF This function is used to turn off the switch of the Assert function and invalidate the Assert function. 5.16.2 Function: Assert This function enables you to assert expressions. When the value of an expression is False, a running task is interrupted. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-295 M2000 iSStar User Guide 5 HFC Library Reference 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 It indicates an expression to be asserted. When the value of cond is False, the content of prompt is exported, and a running task exits exceptionally. prompt prompt is a string. It indicates an exceptional information to be exported. Return Value None. Error Handling None. 5.16.3 Function: Assert_ON This function enables you to turn on the switch of the Assert function and validate the Assert function. Synopsis Assert_ON() Note By default, the Assert function is invalid. Parameter Description None. Return Value None. Error Handling None. 5-296 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 5.16.4 Function: Assert_OFF This function enables you to turn off the switch of the Assert function and invalidate the Assert function. Synopsis Assert_OFF() Note None. Parameter Description None. Return Value None. Error Handling None. 5.17 Mail Sending Function The functions of setting the mail server information, setting mail information, and sending mails are available. 5.17.1 Function: CreateLoginInfo This function is used to set the mail server. 5.17.2 Function: CreateMailInfo This function is used to set the information about a new mail, such as the receiver, copy-to, mail subject, and text. 5.17.3 Function: SendMail This function is used to generate the mail contents based on mail information and send mails. After the mails are sent, the SendMail function disconnects from the mail server automatically. 5.17.1 Function: CreateLoginInfo This function is used to set the mail server. Synopsis CreateLoginInfo(SERVER_ADDR,SERVER_PORT) Note None. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-297 M2000 iSStar User Guide 5 HFC Library Reference Description Parameter Description SERVER_ADDR SERVER_ADDR is a dictionary key value. It indicates the address of the SMTP mail server. The value is a string of characters. SERVER_PORT SERVER_PORT is a dictionary key value. It indicates the port of the mail server. The default value is 25. The value is an integer. Return Value Return the data dictionary of the mail server information. Set the value based on the key value of the data dictionary. It is used to set other optional information of the mail server. The options that can be set include: l SSL_MODE: SSL_MODE is a dictionary key value. It indicates whether the mail server supports SSL mode. The options are Boolean values, True or False. The default value is True. l NICK_NAME: NICK_NAME is a dictionary key value. It indicates the nick name of the user. The value is a string of characters. l USER_NAME: USER_NAME is a dictionary key value. It indicates the mail user registered on the mail server. The value is a string of characters. l PASSWORD: PASSWORD is a dictionary key value. It indicates the password of the mail user. The value is a string of characters. Error Handling Obtain the error information by using the GetLastError function and the GetErroMsg function. Example # Replace smtp.test.com in the following example with the actual domain name of the smtp mail serv # Set the information of the mail server. The default port number is 25. loginInfo=CreateLoginInfo('smtp.test.com') # Set the following information as required. loginInfo['SSL_MODE']=False loginInfo['NICK_NAME']='tester' loginInfo['USER_NAME']='' loginInfo['PASSWORD']='' # 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']='[email protected]' mailInfo1['CC_ADDR']=('[email protected]','[email protected]') mailInfo1['BCC_ADDR']=['[email protected]','[email protected]'] # Set the following information as required. mailInfo1['FROM_ADDR']='[email protected]' 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']='[email protected]' 5-298 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference 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.17.2 Function: CreateMailInfo This function is used to set the information about a new mail, such as the receiver, copy-to, mail subject, and text. Synopsis CreateMailInfo() Note None Description None Return Value Return the data dictionary of mail information. Set the value based on the key value of the data dictionary. It is used to set other optional information of the mail server. The options that can be set include: l FROM_ADDR: FROM_ADDR is a dictionary key value. It indicates the receiver address of the mail. The value is a string of characters. l TO_ADDR: TO_ADDRis a dictionary key value. It indicates the address list of the mail to be sent. The value is a string of characters, or a tuple or list of character strings. Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-299 M2000 iSStar User Guide 5 HFC Library Reference NOTE l TO_ADDR, CC_ADDR, and BCC_ADDR cannot be null at the same time. l 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 (","). l CC_ADDR: Indicates the address list of the copy-to mails. The value is the same as that of TO_ADDR. l BCC_ADDR: Indicates the address list of the blind-copy mails. The value is the same as that of TO_ADDR. l MAIL_SUBJECT: MAIL_SUBJECT is a dictionary key value. It indicates the subject of the mail. The value is a string of characters. l MAIL_BODY: MAIL_BODY is a dictionary key value. It indicates the text of the mail. The value is a string of characters. l MAIL_ATTACH: MAIL_ATTACH is a dictionary key value. It indicates the list of attachments of the mail. The value is a string of characters. NOTE 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']='[email protected]' mailInfo1['CC_ADDR']=('[email protected]','[email protected]') mailInfo1['BCC_ADDR']=['[email protected]','[email protected]'] # Set the following information as required. mailInfo1['FROM_ADDR']='[email protected]' 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']='[email protected]' 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) M2000 iSStar User Guide 5 HFC Library Reference # 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.17.3 Function: SendMail This function is used to generate the mail contents based on mail information and send mails. After the mails are sent, the SendMail function disconnects from the mail server automatically. Synopsis SendMail(mailInfos) Note None. Description Parameter Description mailInfos This parameter indicates a singular mailInfo instance created by CreateMailInfo, or a list composed by multiple mailInfo instance. Return Value If the parameter is a singular mailInfo instance or a list composed by one mailInfo instance, this function returns an struct including error code and error message; if the parameter is a list composed by multiple mailInfo instance (two or more), this function returns a same-length list which is composed by the corresponding structs including error code and error message. Errors that occur during mails sending can be located based on error codes. There are six kinds of error codes: l 0: Successful execution l 1: Error in SMTP server connection l 2: Login error l 3: Incorrect mail address Issue 01 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5-301 M2000 iSStar User Guide 5 HFC Library Reference l 4: Error in attachment loading l 5: Incorrect user parameters 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']='[email protected]' mailInfo1['CC_ADDR']=('[email protected]','[email protected]') mailInfo1['BCC_ADDR']=['[email protected]','[email protected]'] # Set the following information as required. mailInfo1['FROM_ADDR']='[email protected]' 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']='[email protected]' 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08) 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 F format of Time function, 5-192 function, 4-9 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 (2008–12–08) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 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 N 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 U NotifyProgress function, 5-209 number, 4-10 Upload function, 5-216 UserInput function, 5-202 UserOutput function, 5-203 O W Open function, 5-266 operator, 4-4 output function, 5-201 OutputText function, 5-203 Wait function, 5-293 while loop, 4-7 write function, 5-268 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 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Issue 01 (2008–12–08)
Copyright © 2024 DOKUMEN.SITE Inc.