Академический Документы
Профессиональный Документы
Культура Документы
Title page
Alcatel-Lucent 9959
Network Performance Optimizer | M4
Diagnosis Development User Guide
diagug
3BK174465116TQZZA
Alcatel-Lucent Proprietary
Use pursuant to applicable agreements
Issue 10
March 2011
Use pursuant to applicable agreements
Legal notice
Legal notice
Alcatel, Lucent, Alcatel-Lucent and the Alcatel-Lucent logo are trademarks of Alcatel-Lucent. All other trademarks are the property of their respective
owners.
The information presented is subject to change without notice. Alcatel-Lucent assumes no responsibility for inaccuracies contained herein.
Copyright 2011 Alcatel-Lucent. All rights reserved.
Contains proprietary/trade secret information which is the property of Alcatel-Lucent and must not be made available to, or copied or used by anyone outside
Alcatel-Lucent without its written authorization.
Not to be used or disclosed except in accordance with applicable agreements.
Alcatel-Lucent Proprietary
Use pursuant to applicable agreements
Contents
Preface
Purpose .......................................................................................................................................................................................... xiii
xiii
1 Basic concepts
2 Diagnosis editor
3 Scenarios
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary iii
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Contents
....................................................................................................................................................................................................................................
Procedure 3-1: Create scenario ............................................................................................................................................ 3-4
3-4
....................................................................................................................................................................................................................................
Manipulate lists ....................................................................................................................................................................... 4-16
4-16
5 Example Scenarios
6 Introduction to Python
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary v
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Contents
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
vi Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
List of tables
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary vii
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
List of tables
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
viii Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
List of figures
2-20 Links and links with iteration in scenario graphical editor ...................................................................... 2-21
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary ix
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
List of figures
....................................................................................................................................................................................................................................
2-23 Editing node code in scenario graphical editor ............................................................................................ 2-25
2-31 Example 1 context menu on property view - key and value ................................................................... 2-31
....................................................................................................................................................................................................................................
x Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
List of procedures
2 Diagnosis editor
3 Scenarios
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary xi
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
List of procedures
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
xii Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Preface
Preface
Purpose
This document describes the diagnostic solutions provided by the NPO and the Diagnosis
Editor.
Document pertinence
This document applies to the NPO M4.1 projects.
Audience
This guide is intended for operators responsible for diagnosing QoS problems.
Assumed knowledge
You must be familiar with the radio network and Network Performance Optimizer (NPO)
concepts.
Product names
This document uses the following NPO naming convention: 9959 NPO and the generic
term NPO refer to the Alcatel-Lucent 9959 Network Performance Optimizer.
How to comment
To comment on this document or indicate an error, please contact your customer
representative.
...................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary xiii
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Preface
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
xiv Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
1 Basic concepts
1
Overview
Purpose
This section provides an overview of the NPO Diagnosis tool architecture.
Contents
Terminology 1-1
Diagnosis module process 1-2
Terminology
The following table lists the frequently used terms and corresponding definitions.
Term Definition
Diagnosis A diagnosis scenario is an analysis tree that contains ways to investigate a
Scenario quality of service problem using the data available in the NPO. The
scenario can be system or user defined.
Node Nodes provide code that implements checks in order to evaluate the
possible cause of a problem.
Link Links provide the association between nodes. A link is oriented from a
consequence node to a causal node.
Eclipse Eclipse is the Diagnosis Development Tool, used to define diagnosis
scenarios.
Node Code The Node Code Editor is used to write the node code.
Editor
...................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 1-1
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Basic concepts Diagnosis module process
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
1-2 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
2 Diagnosis editor
2
Overview
Purpose
This section presents an overview of the Diagnosis Editor.
Contents
Eclipse environment
Eclipse is an open source community whose projects are focused on providing an
extensible development platform and application frameworks for building software. It has
a generic set of development services that can be used by any plugin tool and includes a
built-in Java Development Tool plugin.
Eclipse provides the diagnosis expert with a graphical development environment for
diagnosis design and scenario creation. The user draws a diagnosis causal tree and then
writes each node code, all of them in a user-friendly environment.
The Eclipse Platform User Interface is built around the concept of a window that provides
an overall structure and presents an extensible user interface to the user. The following
complete window is known as the Diagnosis Editor (see the following figure).
...................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-1
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Eclipse environment
....................................................................................................................................................................................................................................
Title bar
The title bar is the strip at the at the top of the Diagnosis Editor window.
It begins with an icon and is followed by the application name, the user name, server IP
address and the name of the currently opened scenario.
All these are configurable and mandatory. On the right, several icons allow you to
minimize, maximize or close the application.
....................................................................................................................................................................................................................................
2-2 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Eclipse environment
....................................................................................................................................................................................................................................
Editors
Editors allow the user to open, edit, and save objects. They follow an open-save-close
lifecycle much like file system based tools, but are more tightly integrated into the
window. When active, an editor can contribute actions to the Diagnosis Editor window
menus and tool bar.
Two editors appear in tabs in the middle of the window:
Scenario Graphical Editor
Node Code Editor.
Views
Views provide information about the object that the user is working with in the Diagnosis
Editor window. Modifications made in a view (such as changing a property value) are
generally saved immediately, and the changes are reflected immediately in other, related
parts of the user interface.
There are four views in the Diagnosis Editor window:
Scenarios View
Node Outline View
Properties View
Problems View.
The Properties View and Problems View, corresponding to the Scenario Graphical Editor
and Node Code Editor, are also displayed in tabs.
The user can rearrange a view or an editor by dragging and dropping and by customizing
to better suit a particular task (resizing is possible, moving to the splitters that separate
views and editors to the left, to the right, to the bottom or to the top).
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-3
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Procedure 2-1: Start diagnosis editor
....................................................................................................................................................................................................................................
2 Check that the Diagnosis Editor window appears to the user, with all parts displayed at
their default location, as shown in the following figure.
Result: The Diagnosis Editor window is complete.
E...................................................................................................................................................................................................
....................................................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
The Title bar of the Diagnosis Editor window displays:
The Alcatel-Lucent Diagnosis Editor
The user name
The server IP address or server hostname.
The title bar is updated once a scenario is opened with the name of scenario.
The customized menus appear below the Title bar:
Scenario Menu item, with all the options related to a scenario
Nodes Menu item, with all options related to a node
Help menu item.
Note: Each item in the menu is Enabled/Disabled according to the FAD available to
the current user.
Below the customized menus, there are the customized tool bars that provide a quick
access to the options available under the menus.
To the left is the Scenario Tree Viewer. On startup, a list of available scenario names is
provided from the server. A tree displaying the list of scenarios is populated and displayed
under this view.
On startup, these parts are empty and they are populated only when there is an active
scenario:
To the right, the Node Outline View
On the bottom, the Properties and Problems Views
In the center, the Scenario Graphical Editor.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-5
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Procedure 2-2: Display scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
2-6 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Procedure 2-3: Close diagnosis editor
....................................................................................................................................................................................................................................
1 Select Scenario->Exit.
Result: If there are any unsaved scenarios, a dialog box listing the scenarios that need
to be saved appears.
...................................................................................................................................................................................................
3 Click on OK.
Result: The Diagnosis Editor closes.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-7
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Icon Description
If the scenario is a system scenario supplied by Alcatel-Lucent.
If the scenario is created by customer and it belongs to the
customer dictionary.
....................................................................................................................................................................................................................................
2-8 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Table 2-1 Scenario tree view icons (continued)
Icon Description
If the scenario is created by the customer and it is not validated.
If the scenario is a system scenario and it is not validated.
A scenario is available in the Analysis Desktop and can be executed only when it is
validated.
A single click selection of a scenario in Scenario Tree View does not imply that the
scenario appears in the Scenario Graphical Viewer. Similarly, a scenario selected in the
Scenario Graphical Viewer does not imply that the respective scenario is selected in the
Scenario Tree View.
By default, the Scenario Tree View part appears to the left of the Diagnosis Editor.
When the Link with Editor menu item from the Scenario Tree Tool bar
is enabled:
Selecting any scenario in the Scenario Tree brings to the front the corresponding
Graphical Editor for that scenario (if the scenario is currently opened)
On changing tabs between the Graphical Editor, the corresponding scenario name is
selected in the Scenario Tree View.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-9
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Available nodes are displayed in a list view format, in this order:
First Node
Standard Nodes in alphabetical order
External Nodes in alphabetical order.
Each node has a related icon representing the node type, as described in the following
table.
By default, the Node Outline View appears to the right of the Diagnosis Editor.
Once the Node Code Editor is opened for editing a node code, the Node Outline View
displays the libraries and the variables defined for the node.
To Click on
Sort the elements alphabetically
Hide the comments
Hide the libraries
Collapse all
....................................................................................................................................................................................................................................
2-10 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
To Click on
Expand all
Property view
Property View displays all properties linked to a Scenario, a Node or a Link. The
properties view gets populated based on the context of user operation.
If a scenario is opened and no nodes are selected in the scenario, then the property view
displays the details related to the scenario.
If a node is selected in the Scenario Graphical Editor or in Node Outline View, then it
displays the properties of the node.
If a link between two nodes is selected, then the properties for the link are displayed.
By default, the Property View appears at the bottom of the Diagnosis Editor.
When selecting the first icon from the Property tool bar, a two option window opens that
allows the user to select the type of properties to display:
Show Categories
Show Advanced Properties.
Node property
If a node is selected in the Scenario Graphical Editor or in the Node Outline View, the
node details are displayed in the property view. If the user has editing rights, the user can
edit node information in the property view by double clicking on the value field for the
respective property.
The user can modify the name of the node, the description and the X and Y coordinates.
On changing any property, the Scenario Graphical Editor and Node Outline View are
automatically updated to reflect the changes.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-11
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Link property
If a link is selected in the Scenario Graphical Editor, the Link Rank appears in the
Property View. If the user has the editing rights, the user can modify the rank associated
with that link. Each link also has a property called Cut off associated with it, meaning
that if the next node proves to be True, the evaluation of the scenario stops immediately
(this is a find first root cause mechanism).
If the link is a link with iteration, along with the rank, the Property window also displays
the Iteration List and the Iteration Variable.
....................................................................................................................................................................................................................................
2-12 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Scenario property
If neither a node nor a link is selected in the Scenario Graphical Editor and a node is not
selected in the Node Outline View, the Property window displays the properties of the
currently active scenario.
Problem view
If there are any errors / problems in the Diagnosis Node Code Editor, the Problem View
displays these errors.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-13
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
To sort the errors, from the tool bar menu, click on the icon and then on Sorting. A
new window opens. Select the sorting criteria.
....................................................................................................................................................................................................................................
2-14 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-15
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
To select filters to be applied on the Problem view, from the tool bar menu, click on the
icon and then on Filters. A list of available filters appears. Check the filters to apply.
To configure filters, select the icon from the tool bar.
The following widow opens.
To Do
Select one filter Check the box related to the filter.
Select all filters Click on Select All.
Deselect all filters Click on Deselect All.
....................................................................................................................................................................................................................................
2-16 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
To Do
Add a new filter Click on New.
A new window opens.
Fill in the filter name, then click on OK.
Remove a filter from the Check the filter and then click on Remove.
list The default filter cannot be removed.
Check the filter to configure, then select the type of elements on which the filter is
configured:
On any element
On any element in the same project
On a selected element only
On a selected element and its children
On a working set.
To select one working set, click on Select... and in the window that opens, check
Window Working Sets or Selected Working Sets.
If necessary, the user can add new working sets.
If required, add a description of the filter type:
Select and fill in the field with the appropriate comment
Select and fill in the field with the appropriate comment.
To filter errors of one severity type, check the box attached to Where severity is, then
check the box attached to the type of problem:
Error
Warning
Info.
Perform one of the following actions.
To Do
Select the type of items Check the box(es) attached to the possible
types (displayed to the right of the window).
Select all types of items Slick on Select All.
Deselect all types of items Click on Deselect All.
Restore the defaults characteristics of the filter Click on Restore Defaults.
To limit visible items per group, from the tool bar menu, click on the icon and then on
Preferences. A new window opens, as shown in the following figure.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-17
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Check the Use marker limits field, fill in the number of visible items, then click on Ok.
To restore the default values (100 items / group), click on Restore Defaults.
....................................................................................................................................................................................................................................
2-18 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Nodes are represented in the Scenario Graphical Editor by specific icons. The node name
appears below the icon. Each node appears at its respective X and Y location, retrieved
from its node property.
When the operator runs the mouse over the node, a tool tip appears, displaying following
information about the node:
Mode name
Mode description
Mode code snipped (first 100 characters).
For an external node, only the node name appears when the operator runs the mouse over
the node.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-19
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Select multiple nodes in the Scenario Graphical Editor by holding down the Ctrl or Shift
keys and clicking on various nodes, or by pressing the left mouse button and dragging the
selection box over the nodes to be selected.
Note: For a node to be selected, the node must be completely within the bounding
selection rectangle.
For example, in the following figure, six nodes are selected.
....................................................................................................................................................................................................................................
2-20 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Links
Links are also known as connections. The link orientation defines the causality between
two nodes (which node is the cause, which node is the consequence). A consequence node
can have several causal nodes. Links between nodes are directed to visually represent the
flow of execution. The rank associated with the links decides the order of execution of
casualty nodes.
The link can also carry an iteration variable enabling it to test the next node on a set of
variables (for example, for neighbor or adjacency checks provided for a given cell).
Links with iteration are represented using dotted blue directed lines.
Links can also be defined as cutoff, meaning that if the causal node proves to be true, the
evaluation of all sibling nodes is skipped. The rank of a cutoff link is displayed in pink, as
shown in the following figure.
Figure 2-20 Links and links with iteration in scenario graphical editor
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-21
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Fly-out palette
Use the fly-out palette to:
Select a node / link
Create new nodes / links.
Table 2-2 Fly-out palette icons
....................................................................................................................................................................................................................................
2-22 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-23
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
2-24 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
By default, the Fly-out palette appears to the right of the Scenario Graphical Editor.
To change the position of the palette, right click on Palette and select Dock on> Left.
To resize the palette, right click on Palette and select Resize.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-25
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
In the case of a scenario, the Editor (Tab) title displays the name of the scenario. When
editing a node's code, the editor title displays the name of the corresponding node. An
additional * appears if the current editor is modified. The * is not shown if the current
editor is saved.
The Python libraries are used in the node code definition when the user wants to access to
QoS indicator, a parameter value, or to navigate in the topology. The QoS and parameters
libraries are generated by the offline tools when the dictionaries are imported. Only the
topology navigation are hard coded. The use of the libraries allows completion when
typing an indicator or parameter value.
By default, the Node Code Editor appears in the center of the Diagnosis Editor.
The following table lists the scenario menu items and their corresponding descriptions.
....................................................................................................................................................................................................................................
2-26 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-27
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
The following table lists the Node menu items and their corresponding descriptions.
....................................................................................................................................................................................................................................
2-28 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Tool bar
The icons on the tool bar display associated tool tips, specifying the meaning of the icon
when mouse is moved over them, as described in the following table.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-29
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Popup menus
Note: All popup menus are context sensitive. Menu items are present / enabled /
disabled, based on the current context.
The following figure shows the context menu on the scenario tree viewer.
If there are no scenarios selected when the user right clicks on the Scenario Tree View, all
options on the context menu, except Create Scenario under the new menu, are disabled.
The following figure shows the context menu in the scenario graphical editor.
....................................................................................................................................................................................................................................
2-30 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
The following figure shows the node context menu in the graphical editor.
In the last two popup menus, the Create First Node option appears only when the first
node does not exist (it is deleted).
Figure 2-31 Example 1 context menu on property view - key and value
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-31
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Figure 2-33 Context menu on indicator association in scenario wizard
....................................................................................................................................................................................................................................
2-32 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
Customize
You can maximize or minimize all views and editors, by clicking on one of the two
buttons situated in the top right corner of each window, or by clicking on one of the
following options.
To Do
Minimize the window Click on .
Maximize the window Click on .
Restore the window Click on .
This option is only available if one of the first
two was selected.
Modify the size of each window Drag and drop the splitters that separate the
windows.
Move views All windows can be moved from the default
position.
From the popup menu of the views, select:
Move-> View to move one view
Move-> Tab Group to move both the
Property View and Problem View.
Move editors All windows can be moved from the default
position.
From the popup menu of the Scenario
Graphical Editor, select:
Move->Editor to move one editor
Move-> Tab Group to move all open
editors.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 2-33
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Diagnosis editor Diagnosis editor GUI
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
2-34 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
3 Scenarios
3
Overview
Purpose
This section describes how to manipulate a scenario via the system.
Contents
...................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-1
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Scenario Tree
....................................................................................................................................................................................................................................
Scenario Tree
A diagnosis scenario is a formal description of a causal graph expressed as a linked set of
nodes. Each node provides code that implements checks in order to evaluate the possible
cause of a problem.
The maximum number of nodes in a scenario is limited to 150 nodes.
There are three types of nodes.
Node Description
First node Appears at the beginning of a scenario and is the entry point
of the scenario execution. A scenario must have a first node.
Only one first node is accepted.
Classic node This is the basic node. There can be as many basic nodes as
required.
External node Represents a node from another scenario.
Nodes are associated by means of links. A link is oriented from a consequence node to a
causal node. A consequence node can have several causal nodes.
A link contains the variable associations between the casual and consequence nodes.
There are two types of links:
The classic link
The link with iteration (list and variable).
The arrow of the links differs depending on the link type.
The NPO concept of the Availability domain is reused to specify on which object types
the scenarios are valid at each temporal level. The availability domain is defined by the
scenario developer.
A diagnosis scenario can reference a QoS indicator that semiautomatically triggers the
execution of the scenario on the threshold crossing. If no reference indicator was set, the
execution of the scenario can be triggered through a manual Network Object selection
operation in the Analysis Desktop.
The maximum number of Network Objects in the execution context is configurable.
Diagnosis is the process of execution of a scenario applied on an initial context.
A diagnosis can be executed:
On one object
The textual output describes probable failure cause and the possible remedy.
On a set of objects.
The output provides the list of objects which were identified by the scenario.
The intent is to select cells candidate for further analysis.
Diagnosis scenario result reports are provided in a synthetic or detailed way, depending
on the execution mode.
....................................................................................................................................................................................................................................
3-2 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Scenario Tree
....................................................................................................................................................................................................................................
Execution modes / context
Mode Description
Detailed Mode Launches a diagnosis execution, specified by
the user, on a single network object, at a
specific date, for a given periodicity, with a
given QoS requirement level (taken from the
current working zone).
This mode is used to interactively launch the
diagnosis from the NPO application. An
HTML report is generated.
Synthetic Mode Available for one or many network objects
(with the associated parameter), and optionally
with a date and a periodicity if the input
context contains the corresponding variables.
The QoS requirement level is required if a date
and periodicity are given.
This execution mode is similar to a classical
view execution for QoS or parameter in the
NPO. The Analysis Desktop basically displays
a matrix of Boolean values, but it can also
return string values with the status. The
Synthetic mode implies that the diagnosis
execution stops at the first detected problem.
Tuning Session Mode Launches the execution of specific scenarios
(called complex rules) that are used to check
parameter validity.
Use a specific diagnosis tuning session
checking scenario when the simple grammar
defined for the rules is not sufficient to express
the complexity of the check, for example,
when some topology navigation is required.
For more information about the execution of a scenario, refer to the Network Performance
Optimizer User Guide document, to Execute diagnosis in synthetic mode and Execute
diagnosis in detailed mode.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-3
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
3-4 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-5
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
Result: A default scenario name is populated based on the current user. The title area
displays messages / errors, if any, while creating a scenario.
...................................................................................................................................................................................................
....................................................................................................................................................................................................................................
3-6 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
4 Click on Next.
Result: The Trigger Association Page appears, based on the scenario type selected.
For a Diagnosis type scenario, the Trigger Association Page appears as shown in the
following figure.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-7
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
A tree containing the list of available Indicators associated with the selected object
type appears.
For a Complex Rule type scenario, the Trigger Association Page appears as shown in
the following figure.
....................................................................................................................................................................................................................................
3-8 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
5 For a Diagnosis type scenario, double click on an indicator from the Indicator Tree to set
the selected indicator.
To clear the currently selected Indicator, click on Clear.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-9
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
To search for an indicator:
From the popup menu, select Search
Fill in the indicator's name in the new open window and, if necessary, check one of
the search options
Click on Find Next.
For a Complex Rule type scenario, click on Add... to set the parameter.
Result: A new window opens (see the following figure), displaying the parameters
divided in two trees, in separate tabs:
Design Parameters
Logical Parameters.
....................................................................................................................................................................................................................................
3-10 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-11
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-1: Create scenario
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
6 For a Complex Rule type scenario, double click on a parameter from one of the lists.
Result: The parameter is selected.
...................................................................................................................................................................................................
7 Click on OK.
Click on Remove to remove the selected parameter.
Result: The Associate Parameter(s) with Scenario window closes.
...................................................................................................................................................................................................
8 Click on Finish.
Result: The scenario is created.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-12 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-2: Create scenario by copy
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
3 Click on Yes.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-13
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-2: Create scenario by copy
....................................................................................................................................................................................................................................
Result: If the scenario is not currently open in the Graphical Editor, a progress bar
appears while the scenario information is retrieved from the server.
All the scenario properties are copied, and the following properties are changed by
default:
The name of the scenario to oldname_copy_n, where oldname is the name of
the scenario being copied and n is the copy number
The owner is set to the current user name
Access rights are set to Public.
...................................................................................................................................................................................................
4 To modify any scenario properties, refer to Procedure 3-1: Create scenario (p. 3-4).
Result: The scenario properties are modified accordingly.
...................................................................................................................................................................................................
5 Click on Finish.
Result: The scenario details are only updated in the local files. The scenario must be
saved for it to be reflected on the server.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-14 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-3: Edit scenario / scenario properties
....................................................................................................................................................................................................................................
Once the scenario information is retrieved, a two page wizard appears (one page after
the other) for editing the scenario properties.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-15
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-3: Edit scenario / scenario properties
....................................................................................................................................................................................................................................
If the scenario is not currently open in the graphical editor (or if the user does not
have the privilege to modify the selected scenario), the wizard displays scenario
properties with all fields disabled.
A user can edit the scenario if:
The scenario is not a system scenario, if the user is the owner of the scenario, and
if the scenario is not currently locked by another user
The user is an administrator and the scenario is not currently locked by another
user.
...................................................................................................................................................................................................
3 To modify any scenario properties, refer to Procedure 3-1: Create scenario (p. 3-4).
You can only modify enabled fields.
Result: The scenario properties are modified accordingly.
...................................................................................................................................................................................................
4 Click on Finish.
Result: The scenario details are only updated in the local files. The scenario must be
saved for it to be reflected on the server.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-16 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-4: Validate / check scenario
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
3 Click on OK.
Result: The scenario is validated.
The following modifications to a validated scenario automatically mark the scenario
as invalid:
Adding / deleting nodes or links
Editing node code
Modifying scenario properties.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-17
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-5: Save scenario
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
3 Click on OK.
Result: The scenario is saved.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-18 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-6: Print scenario
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
To Click on
Print scenario graphical layout and scenario Scenario Details
details
Print all information (scenario node layout, All Information
scenario details, node details and node layout)
Cancel the print request Cancel
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-19
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-7: Delete scenario
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
3 Click on Yes.
Result: If the scenario was opened in the Graphical Editor, the associate editors
(including the Node Code Editor) close.
The scenario is deleted and removed from the Scenario Tree View.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-20 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-8: Create node
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-21
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-8.1: First node
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
3 Click on OK.
Result: The first node is created and displayed in the Scenario Editor and in the Node
Outline View.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-22 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-8.2: Node
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
3 Click on OK.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-23
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-8.2: Node
....................................................................................................................................................................................................................................
Result: The node is created and displayed in the Scenario Editor and in the Node
Outline View.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-24 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-8.3: External node
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-25
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-8.3: External node
....................................................................................................................................................................................................................................
Result: The name is defined.
...................................................................................................................................................................................................
3 Click on OK.
Result: The node is created and displayed in the Scenario Editor and in the Node
Outline View.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-26 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-9: Edit node properties
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
1 Double click on the property value in the Value Column for the following values and fill
in the new values:
Node Name
Description
X and Y coordinate.
Only these fields are editable.
Result: The new values are defined.
...................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-27
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-10: Edit node links
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
3-28 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-10.1: Create new link
....................................................................................................................................................................................................................................
1 In the Fly-out palette in the Scenario Graphical Editor, click on Create a link.
Result: The cursor is updated to indicate that a link is selected.
...................................................................................................................................................................................................
2 Move the cursor in the Scenario Graphical Editor Node Area (white area) and put it over a
node.
Result: The node selected is called the Cause node.
...................................................................................................................................................................................................
Note that the Cause node name and the Consequence node name are displayed in the
dialog box.
...................................................................................................................................................................................................
4 Fill in the rank of the node with the appropriate value (a default value appears).
Result: The node rank is defined.
...................................................................................................................................................................................................
5 If the link created is a cutoff link, then check the Cutoff field.
Result: The Cutoff field is completed.
...................................................................................................................................................................................................
6 Click on OK.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-29
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-10.1: Create new link
....................................................................................................................................................................................................................................
Result: The link is created and reflected with a directional line between the two nodes
(from the Cause node to the Consequence node).
The rank of the link appears closed to the target node (it is indicated in pink if the
Cutoff field was checked).
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-30 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-10.2: Link with iteration
....................................................................................................................................................................................................................................
1 In the Fly-out palette in the Scenario Graphical Editor, click on Link With Iteration.
Result: The cursor is updated to display that a link is selected.
...................................................................................................................................................................................................
2 Move the cursor in the Scenario Graphical Editor Node Area (white area) and put it over a
node.
Result: The selected node is called the Cause node.
...................................................................................................................................................................................................
Note that the Cause node name and the Consequence node name are displayed in the
dialog box.
...................................................................................................................................................................................................
4 Fill in the rank of the node with the appropriate value (a default value appears).
Result: The node rank is defined.
...................................................................................................................................................................................................
5 If the link created is a cutoff link, then check the Cutoff field.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-31
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-10.2: Link with iteration
....................................................................................................................................................................................................................................
Result: The Cutoff field is completed.
...................................................................................................................................................................................................
6 Click on OK.
Result: The link is created and reflected with a directional line between the two nodes
(from the Cause node to the Consequence node).
The rank of the link appears closed to the target node (it is indicated in pink if the
Cutoff field was checked).
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-32 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-10.3: Move link
....................................................................................................................................................................................................................................
2 Put the mouse on the extremity you want to move and drag the link to the new node.
Result: The link is moved.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-33
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-11: Edit link properties
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
1 Double click on the property value in the Value Column for the following values and fill
in the new values:
Rank
Cutoff
Iteration List (in the case of a link with iteration)
Iteration Variable (in the case of a link with iteration).
Only these fields are editable.
Result: The new values are defined.
...................................................................................................................................................................................................
....................................................................................................................................................................................................................................
3-34 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-12: Copy node
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-35
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-12: Copy node
....................................................................................................................................................................................................................................
Result: A new dialog box opens that allows the user to select the type of node to paste
(by default, the standard node).
...................................................................................................................................................................................................
....................................................................................................................................................................................................................................
3-36 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Scenarios Procedure 3-12: Copy node
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
5 Fill in the two fields with the appropriate values, then click on OK.
Result: The node is copied and pasted and displayed in the Scenario Graphical Editor
and Node Outline View.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 3-37
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Scenarios Procedure 3-13: Delete node / link
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
4 Click on OK.
Result: The node / link is deleted.
If a node is deleted from a scenario, all the links associated to the node are also
deleted (the scenario links and the links defined in other scenarios).
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
3-38 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
4 Edit node code
4
Overview
Purpose
This section describes how to edit a node in the Node Code Editor and how to manage the
telecom primitives.
Contents
...................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-1
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Procedure 4-1: Open node code editor
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
4-2 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Import libraries
....................................................................................................................................................................................................................................
Import libraries
The NPO Diagnosis Library defines telecom primitives that are predefined to build test
expressions and node code.
Primitives are functions that allow access to the data (indicators, parameter, topology
object).
They are available only when the related library is imported into the code.
The libraries are imported in the Diagnosis Editor manually by the user each time a node
code is developed, by typing the following command:
import library_name
Due to Python Syntax highlighting, the word import is always written in blue.
The following table presents the types of library.
Library Definition
I_technology name QoS Indicator for specified technology
Example: I_GSM; I_WiMAX; I_UMTS
P_technology name Logical radio parameters and the radio network design for specified
technology
Example: P_GSM; P_WiMAX; P_UMTS
P_DN_technology Logical radio parameters and the radio network design for specified
name technology; the primitive name is constructed with the displayed names.
Example: P_DN_GSM.MNC()
N Generic topology primitives
N_Technology Navigation topology for a technology
Example: N_GSM
Generic Filtering and generic primitives
Example: Generic.filterOnParameter()
Tuning Tuning primitives
Example: Tuning.advice_tuning()
set Manipulation of list
Note: If you want to access the value of a customer indicator, you must use the
get_indicator(object, <customer_indicator_name>) primitive, because
only system indicators are present in the I_technology.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-3
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Procedure 4-2: Define variables
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
...................................................................................................................................................................................................
3 If necessary, fill in the parameters related to that primitive with the appropriate value.
Result: The parameters are defined.
E...................................................................................................................................................................................................
N D O F S T E P S
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-5
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Input parameters for radio parameter primitives
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
4-6 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Topology navigation primitives
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-7
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Topology navigation primitives
....................................................................................................................................................................................................................................
Besides these primitives, there is a specific set of primitives for W-CDMA, as shown in
the following table.
For GSM technology, the prefix is N_GSM. Refer to the following sections for the
proposed primitives.
....................................................................................................................................................................................................................................
4-8 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Cell navigation primitives
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-9
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Cell navigation primitives
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
4-10 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Indicator and parameter generic primitives
....................................................................................................................................................................................................................................
Note: The date (aDate) input parameter is optional. By default, the date global
variable is used.
Example:
Generic.get_indicator(DR_Out_unsuccess_rate, object) has the same
effect as I_GSM.DR_Out_unsuccess_rate(object).
Generic.get_parameter(TIMER_T11,object,OP) has the same effect as
P_GSM.TIMER_T11(object, OP).
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-11
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Threshold primitives
....................................................................................................................................................................................................................................
Threshold primitives
Threshold primitives are used to test an indicator value with its threshold. Primitives are
provided in order to be able to verify the color of the indicator.
When the QoS Requirement (optional parameter) is not provided in any of the above
primitives, it must be retrieved form the current working zone.
Possible QoS requirement values are:
LOW
MEDIUM
HIGH.
....................................................................................................................................................................................................................................
4-12 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Filtering primitives
....................................................................................................................................................................................................................................
Filtering primitives
Filtering primitives are provided to the user to permit the limitation of a Network Objects
number from a greater number, using selection criteria. One primitive is for filtering by
QoS indicator values, and the other is for filtering by parameter values.
These primitives are available once the Generic library is imported.
Operator Meaning
> Greater than
< Smaller than
= Equal
>= Greater than or equal to
<= Smaller than or equal to
<> Not equal
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-13
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Filtering primitives
....................................................................................................................................................................................................................................
Example:
Parameters Results
FilterOnQosIndicator(Ec1,"RTCH_ From the cell list Ec1, returns a list of cells
duration_avg","=","0") where the indicator RTCH_duration_avg = 0
for a given date and periodicity.
FilterOnParameter(Ec1,"L_RXLEVMIN_ From the cell list Ec1, returns a list of cells
UHL","<","-100") where the parameter L_RXLEVMIN_UHL <
-100.
Tuning primitives
Tuning primitives permit the creation of tuning operations linked to the result of a
diagnosis execution. These operations are used for a tuning session creation in the
Analysis Desktop.
....................................................................................................................................................................................................................................
4-14 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Tuning primitives
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-15
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Tuning primitives
....................................................................................................................................................................................................................................
For each primitive that requests parameter queries, the parameter name type is provided
in order to choose if the given parameter name is the system name or the displayed name.
The possible values are:
SYST
DISP.
The default value is SYST.
Manipulate lists
Once the set library is imported, lists can be manipulated using the following primitives.
Primitive Meaning
difference(a, Returns the difference of two sets as a new set (i.e. all elements that are in set a
b) and not in the other (b)).
intersection(a, Returns the intersection of two sets as a new set (i.e. all elements that are in both
b) sets).
isin(element, Reports whether an element is a member of a set. (Called in response to the
l) expression 'element in shelf'.)
issubset(a, Reports if a is a subset of b (if every element of set a is also in set b.
b)
union(a, b) Returns the union of two sets as a new set (i.e. all elements that are in either sets).
For example:
list1 = Generic.FilterOnParameter(cells, "Class", "<>", "URBAN")
....................................................................................................................................................................................................................................
4-16 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Manipulate lists
....................................................................................................................................................................................................................................
list2 = Generic.FilterOnQosIndicator(cells, "Call_setup_success_rate",
">", "10")
list3 = set.intersection(list, list2)
The first list filters and gets cells with a class different to URBAN.
The second list gets cells with Call_setup_success_rate > 10.
The third list gets only the cells with a class different to URBAN and a Call_setup_
success_rate > 10.
Test syntax
Use the Test field to enter the test expressions for the node. The conditional logic in
Python is handled with the if statement:
if(expression):
pbfound("Report when a problem has been found")
else:
nopbfound("Report when no problem has been found")
There can be none or more elif parts, and the else part is optional. The keyword elif
is short for else if and is used to avoid excessive indentation.
The if statement can contain multiple conditions.
The operators between conditions can be:
and
or
if(condition1) or (condition2)
if(condition1 and condition2)
When a loop is declared on a link, the operator indicates the looping variable and the
iteration list. The iteration list always and only contains network objects.
Example:
Test if the SDCCH dropped due to handover problems represent more than 40% of all
SDCCH dropped.
Note: In the Diagnosis Editor, the 10% value is seen as 0.1 value. In the internal
Diagnosis node code, multiply the indicator with 100 in its formula.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-17
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Test syntax
....................................................................................................................................................................................................................................
As seen in the examples, the output message can also contain variables that are processed
during execution.
The variables are indicated with the %s symbol inside the message content.
....................................................................................................................................................................................................................................
4-18 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Test syntax
....................................................................................................................................................................................................................................
After the message, the ways to indicate variables are:
% primitive_name
% (str(<variable_name>))
The primitive str() is used to convert a numeral to string.
If there is more than one variable declared inside the message content, after the
message content, the syntax is:
% (variable_1, variable_2,..., variabile_n).
Highlighting in View is applied for a Diagnosis Executed View (report view), with the
following rules:
Diagnosis result is unknown - orange
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-19
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Test syntax
....................................................................................................................................................................................................................................
For more information about the diagnosis report, refer to the Network Performance
Optimizer User Guide document, to Diagnosis.
Debug traces
Traces are used to detect problems. The examples below show the trace syntax.
bsc = N_GSM.BSC(object) # Get the BSC of the cell
trace("The BSC is %s" % N.getObjectExternalId(bsc))
This prints the external ID of the BSC to which the cell selected in Analysis Desktop
belongs.
cells = N_GSM.Cells(bsc) # get all the cells of the bsc
trace("BSC cells: %s" % str(cells))
This prints the cells of the BSC selected in the Analysis Desktop.
View the output of the traces by selecting, from the Report View, the
Click here to view the trace hyperlink.
A new window called Diagnosis Execution Logs opens, displaying the problems during
execution.
....................................................................................................................................................................................................................................
4-20 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Edit node code Debug traces
....................................................................................................................................................................................................................................
Some traces can still appear in the window even if nothing is defined in the case of
execution exceptions.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 4-21
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Edit node code Debug traces
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
4-22 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
5 Example Scenarios
5
Overview
Purpose
This section presents some example scenarios.
Contents
...................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-1
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios V2_DR (GSM technology) scenario
....................................................................................................................................................................................................................................
This scenario is a system scenario that verifies why the Directed Retry feature is not
working properly.
Scenario properties appear in the Property View.
The list of nodes appears in the Node Outline View, once the scenario appears.
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-3
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios V2_DR (GSM technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
5-4 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Example Scenarios V2_DR (GSM technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-5
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios V2_DR (GSM technology) scenario
....................................................................................................................................................................................................................................
Incorrect A_PBGT_DR problem
NODE: Incorrect A_PBGT_DR problem checks if the A_PBGT_DR parameter has a
correct value.
Node code:
....................................................................................................................................................................................................................................
5-6 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Example Scenarios V2_DR (GSM technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-7
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios V2_DR (GSM technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
5-8 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Example Scenarios V2_SDROP (GSM technology) scenario
....................................................................................................................................................................................................................................
The list of nodes appear in the Node Outline View, once the scenario appears.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-9
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios V2_SDROP (GSM technology) scenario
....................................................................................................................................................................................................................................
SDCCH drop
FIRST NODE: SDCCH drop tests if an excessive percentage of SDCCH channels was
dropped during the signalization phase.
Node code:
Link failure
NODE: Link failure checks LAPD alarms with the following cause:
/"link failures/", /"link re-establishment/".
Node code:
....................................................................................................................................................................................................................................
5-10 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Example Scenarios V2_SDROP (GSM technology) scenario
....................................................................................................................................................................................................................................
Processor restart
NODE: Processor restart checks TCU alarms or BTS / FU alarms with the following
cause:
/"restart/", /"reset/", /"Access failure/".
Node code:
SDCCH drop HO
NODE: SDCCH drop HO checks if the dropped SDCCH come from a handover
problem.
Example 1 of the node code:
Note: The result of the both examples is the same in the case of percentage use.
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-11
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios V2_SDROP (GSM technology) scenario
....................................................................................................................................................................................................................................
SDCCH drop radio
NODE: SDCCH drop radio checks if the dropped SDCCH come from a radio problem.
Node code:
....................................................................................................................................................................................................................................
5-12 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Example Scenarios V2_SDROP (GSM technology) scenario
....................................................................................................................................................................................................................................
TCH HO problem
NODE: TCH HO problem checks if there is also a TCH call drop coming from a
handover problem.
Node code:
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-13
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios WAC cluster configuration (WiMAX technology) scenario
....................................................................................................................................................................................................................................
The list of nodes are displayed in the Node Outline View, once the scenario appears.
....................................................................................................................................................................................................................................
5-14 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Example Scenarios WAC cluster configuration (WiMAX technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-15
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios WAC cluster configuration (WiMAX technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
5-16 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Example Scenarios WAC cluster configuration (WiMAX technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 5-17
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Example Scenarios WAC cluster configuration (WiMAX technology) scenario
....................................................................................................................................................................................................................................
....................................................................................................................................................................................................................................
5-18 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
6 Introduction to Python
6
Overview
Purpose
This section describes how to use Python.
Contents
...................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 6-1
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
SPAM=1 # and this is the second comment
#... and this is the third!
STRING="# This is not a comment"
Numbers
The interpreter acts as a simple calculator; you can type an expression at it and it writes
the value.
Expression syntax is straightforward: the operators +, -, * and / work in a similar way to
most other languages (for example, Pascal or C); parentheses can be used for grouping.
For example:
>>> 2+2
4
>>> # This is a comment
...2+2
4
>>> 2+2 # and a comment on the same line as code
4
>>> (30-3*6)/3
4
>>> # Integer division returns the floor:
... 7/3
2
>>> 7/-3
-3
The equal sign ( = ) is used to assign a value to a variable. Afterwards, no result appears
before the next interactive prompt:
>>> a=3
>>> b=3*10
>>> a+b
33
A value can be assigned to several variables simultaneously:
>>> x=y=z=0 #x, y and z have the value 0
>>> x
0
>>> y
0
>>> z
0
There is full support for a floating point; operators with mixed type operands convert the
integer operand to the floating point:
>>> 3*1.5/2
2.25
Complex numbers are also supported; imaginary numbers are written with a suffix of j or
J. Complex numbers with a nonzero real component are written as ( real + imag j), or
can be created with the complex(real, imag) function.
>>> 1j*1J
(-1+0j)
....................................................................................................................................................................................................................................
6-2 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
>>> 1j*complex(0,1)
(-1+0j)
>>> (1+2j)/complex(1,1)
(1.5+0.5j)
Complex numbers are always represented as two floating point numbers, the real and
imaginary part. To extract these parts from a complex number z, use z.real and
z.imag.
>>> z=2.5+1.5j
>>> z.real
2.5
>>> z.imag
1.5
The conversion functions to floating point and integer (float(), int() and long() )
do not work for complex numbers. There is no one correct way to convert a complex
number to a real number. Use abs(z) to get its magnitude (as a float) or z.real to get
its real part.
>>> z=3+4j
>>> z.real
3
>>> float(z)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: can't convert complex to float; use abs(z)
>>> abs(z) #sqrt(z.real**2+z.imag**2)
5
In interactive mode, the last printed expression is assigned to the variable _. This means
that when you are using Python as a desk calculator, it is somewhat easier to continue
calculations. For example:
>>> a=25
>>> b=0.025
>>> a+b
25.025
>>> round(_,2)
25.02
This variable should be treated as read-only by the user. Do not explicitly assign a value
to it as you would create an independent local variable with the same name, masking the
built-in variable with its magic behavior.
Strings
Besides numbers, Python can also manipulate strings, which can be expressed in several
ways. They can be enclosed in single quotes or double quotes:
>>> 'today is Monday'
'today is Monday'
>>> 'doesn/'t'
"doesn't"
>>> "today is Monday"
"today is Monday"
>>> "/"today/" is Monday"
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 6-3
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
'"today" is Monday'
>>> '"today/'" is Monday'
'"today/'" is Monday'
String literals can span multiple lines in several ways. Continuation lines can be used,
with a backslash as the last character on the line indicating that the next line is a logical
continuation of the line:
>>> hello = "This is a rather long string containing/n/
several lines of text just as you would do in C./n/
Note that whitespace at the beginning of the line is/ significant."
print hello
Note that new lines still need to be embedded in the string using /n; the new line
following the trailing backslash is discarded. This example would print the following:
This is a rather long string containing
several lines of text just as you would do in C.
Note that whitespace at the beginning of the line is/ significant.
If we make the string literal a raw string, however, the /n sequences are not converted to
newlines, but the backslash at the end of the line, and the newline character in the source,
are both included in the string as data. For example:
>>> hello = r"This is a rather long string containing/n/
several lines of text just as you would do in C./n/
print hello
Would print as:
This is a rather long string containing/n/
several lines of text just as you would do in C.
Strings can be surrounded in a pair of matching triple-quotes: " " " or ' ' '. End of
lines do not need to be escaped when using triple-quotes, but they are included in the
string.
>>> print """
Usage: thingy [OPTIONS]
- h Display this usage message
- H hostname Hostname to connect to
"""
Produces the following output:
Usage: thingy [OPTIONS]
- h Display this usage message
- H hostname Hostname to connect to
The interpreter prints the result of string operations in the same way as they are typed for
input: inside quotes, and with quotes and other exceptional characters escaped by
backslashes, to show the precise value. The string is enclosed in double quotes if the
string contains a single quote and no double quotes, otherwise it is enclosed in single
quotes.
Strings can be concatenated (stuck together) with the + operator, and repeated with *:
>>> word='Good' + 'Morning'
>>> word
'GoodMorning'
>>> '<' + word*3 + '>'
....................................................................................................................................................................................................................................
6-4 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
'<GoodMorningGoodMorningGoodMorning'
Two string literals next to each other are automatically concatenated; the first line above
may also have "word = 'Help' 'A'" written; this only works with two literals, not with
arbitrary string expressions:
>>> 'str' 'ing'
'string'
>>> 'str'.strip() + 'ing' # This is ok
'string'
>>> 'str'.strip() 'ing' # This is invalid
File "<stdin>", line 1, in ?
'str'.strip() 'ing'
SyntaxError: invalid syntax
Strings can be subscripted (indexed); as in C, the first character of a string has subscript
(index) 0. There is no separate character type; a character is simply a string of size one.
Like in Icon, substrings can be specified with the slice notation: two indices separated by
a colon. Slice indices have useful defaults; an omitted first index defaults to zero, an
omitted second index defaults to the size of the string being sliced.
>>> word[2] # the second character
'o'
>>> word[0:4] # characters from the first to the fourth
'Good'
>>> word[:4] # the first four characters
'Good'
>>> word[4:] # everything except the first four characters
'Morning'
Unlike a C string, Python strings cannot be changed. Assigning to an indexed position in
the string results in an error.
However, creating a new string with the combined content is easy and efficient:
>>> word[0:4] + 'Night'
'GoodMorning'
Here is a useful invariant of slice operations: s[:i] + s[i:] equals s.
>>> word[:5] + word[5:]
'GoodMorning'
Degenerate slice indices are handled as follows: when an index that is too large is
replaced by the string size, and an upper bound smaller than the lower bound returns an
empty string.
>>> word[1:50]
'oodMorning'
>>> word[15:]
''
>>> word[5:3]
''
Indices may be negative numbers, to start counting from the right. Note that -0 is really
the same as 0, so it does not count from the right! For example:
>>> word[-1] # the last character
'g'
>>> word[-2] # the last-but-one character
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 6-5
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
'g'
>>> word[-2:] # the last two characters
'ng'
>>> word[:-3] # everything except the last three characters
'GoodMorn'
>>> word[-0] # the first character
'G'
Out-of-range negative slice indices are truncated, but do not try this for single-element
(non-slice) indices:
>>> word[-100:]
'GoodMorning'
>>> word[-15] # error
Traceback (most recent call last):
File "<stdin>", line 1, in ?
IndexError: string index out of range
For non-negative indices, the length of a slice is the difference of the indices, if both are
within bounds. For example, the length of word [1:3] is 2.
The built-in len() function returns the length of a string:
>>> len(word)
11
Unicode strings
The Unicode object can be used to store and manipulate Unicode data (see
http://www.unicode.org/) and integrates well with the existing string objects,
providing auto-conversions where necessary. Unicode has the advantage of providing one
ordinal for every character in every script used in modern and ancient texts.
Previously, there were only 256 possible ordinals for script characters. Texts were
typically bound to a code page which mapped the ordinals to script characters. This lead
to very much confusion especially with respect to internationalization (usually written as
i18n - i + 18 characters + n) of software. Unicode solves these problems by defining
one code page for all scripts.
Creating Unicode strings in Python is just as simple as creating normal strings:
>>> u'Good Morning !'
u'Good Morning !'
The small u in front of the quote indicates that a Unicode string is supposed to be created.
If you want to include special characters in the string, you can do so by using the Python
Unicode-Escape encoding, as described in the following example:
>>> u'Good/u0020Morning !'
u'Good Morning !'
The escape sequence /u0020 indicates to insert the Unicode character with the ordinal
value 0x0020 (the space character) at the given position.
Other characters are interpreted by using their respective ordinal values directly as
Unicode ordinals. If you have literal strings in the standard Latin-1 encoding that is used
in many Western countries, you find it convenient that the lower 256 characters of
Unicode are the same as the 256 characters of Latin-1.
....................................................................................................................................................................................................................................
6-6 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
For experts, there is also a raw mode just like the one for normal strings. You have to
prefix the opening quote with ur to have Python use the Raw-Unicode-Escape encoding.
It only applies the above /uXXXX conversion if there is an uneven number of backslashes
in front of the small u.
>>> ur'Good/u0020Morning !'
u'Good Morning !'
>>> ur'Good//u0020Morning !'
u'Good////u0020Morning !'
The raw mode is most useful when you have to enter lots of backslashes, as can be
necessary in regular expressions.
Apart from these standard encodings, Python provides a whole set of other ways of
creating Unicode strings on the basis of a known encoding.
The built-in unicode() function provides access to all registered Unicode codecs
(COders and DECoders). Some of the more well known encodings which these codecs
can convert are Latin-1, ASCII, UTF-8, and UTF-16. The latter two are variable-length
encodings that store each Unicode character in one or more bytes. The default encoding is
normally set to ASCII, which passes through characters in the range 0 to 127 and rejects
any other characters with an error. When a Unicode string is printed, written to a file, or
converted with str(), conversion takes place using this default encoding.
>>> u"abc"
u'abc'
>>> str(u"abc")
'abc'
>>> u"[auml ][ouml ][uuml ]"
u'/xe4/xf6/xfc'
>>> str(u"[auml ][ouml ][uuml ]")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-
2: ordinal not in range(128)
To convert a Unicode string into an 8-bit string using a specific encoding, Unicode
objects provide an encode() method that takes one argument, the name of the encoding.
Lowercase names for encodings are preferred.
>>> u"[auml ][ouml ][uuml ]".encode('utf-8')
'/xc3/xa4/xc3/xb6/xc3/xbc'
If you have data in a specific encoding and want to produce a corresponding Unicode
string from it, you can use the unicode() function with the encoding name as the
second argument.
>>> unicode('/xc3/xa4/xc3/xb6/xc3/xbc', 'utf-8')
u'/xe4/xf6/xfc'
Lists
Python knows a number of compound data types, used to group together other values.
The most versatile is the list, which can be written as a list of comma-separated values
(items) between square brackets. List items need not all have the same type.
>>> a = ['spam', 'eggs', 100, 1234]
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 6-7
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
>>>> a
['spam', 'eggs', 100, 1234]
Like string indices, list indices start at 0, and lists can be sliced, concatenated and so on:
>>> a[0]
'spam'
>>> a[-2]
100
>>> a[1:-1]
['eggs', 100]
>>> a[:2] + ['bacon', 3*3]
['spam', 'eggs', bacon, 9]
>>> 2*a[:2] + ['End!']
['spam', 'eggs', 'spam', 'eggs', 'End!']
Unlike strings, which are immutable, it is possible to change individual elements of a list:
a[2] = a[2] + 23
a
['spam', 'eggs', 123, 1234]
Assignment to slices is also possible, and this can even change the size of the list or clear
it entirely:
>>> # replace some items:
... a[0:2] = [1,12]
>>> a
[1, 12, 123, 1234]
>>> # remove some items:
... a[0:2] = []
>>> a
[123, 1234]
>>> # insert some items:
... a[1:1] = ['yes', 'no']
>>> a
[123, 'yes', 'no', 1234]
>>> # insert (a copy of) itself at the beginning
... a[:0] = a
>>> a
[123, 'yes', 'no', 1234, 123,'yes', 'no', 1234 ]
>>> # clear the list
... a[:] = []
>>> a
[]
The built-in len() function also applies to lists:
>>> len(a)
8
It is possible to nest lists (create lists containing other lists). Note that in the following
example, y[2] and x:
>>> x = [2, 3, 4]
>>> y = [1, x]
>>> y[2]
[2, 3, 4]
y[2][0]
....................................................................................................................................................................................................................................
6-8 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Introduction to Python Getting started with Python
....................................................................................................................................................................................................................................
2
Use Python
About programming
The following example introduces several new features:
>>> # Fibonacci series:
... # the sum of two elements defines the next
... a, b = 0, 1
>>> while b < 10:
... print b
... a, b = b, a+b
...
1
1
2
3
5
8
The first line contains a multiple assignment: the variables a and b simultaneously get
the new values 0 and 1. On the last line this is used again, demonstrating that the
expressions on the right-hand side are all evaluated first before any of the assignments
take place. The right-hand side expressions are evaluated from the left to the right.
The while loop executes as long as the condition (here: b < 10 ) remains true. In
Python, like in C, any non-zero integer value is true; zero is false. The condition may also
be a string or list value, in fact any sequence; anything with a non-zero length is true,
empty sequences are false. The test used in the example is a simple comparison. The
standard comparison operators are written the same as in C: < (less than), > (greater than),
== (equal to), <= (less than or equal to), >= (greater than or equal to) and != (not equal
to).
The body of the loop is indented : indentation is Python's way of grouping statements.
Python does not provide an intelligent input line editing facility, so you have to type a tab
or space(s) for each indented line. In practice, you prepare more complicated input for
Python with a text editor; most text editors have an auto-indent facility. When a
compound statement is entered interactively, it must be followed by a blank line to
indicate completion (since the parser cannot guess when you have typed the last line).
Note that each line within a basic block must be indented by the same amount.
The print statement writes the value of the expression(s) it is given. It differs from just
writing the expression you want to write (as we did earlier in the calculator examples) in
the way it handles multiple expressions and strings. Strings are printed without quotes,
and a space is inserted between items, so you can format things correctly, like this:
>>> i = 5*5
>>> print ' the value of i is', i
the value of i is 25
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 6-9
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Introduction to Python Use Python
....................................................................................................................................................................................................................................
A trailing comma avoids the newline after the output:
>>> a, b = 0, 1
>>> while b < 100:
... print b,
... a, b = b, a+b
...
1 1 2 3 5 8 13 21 34 55 89
Note that the interpreter inserts a new line before it prints the next prompt, if the last line
was not completed.
if statement
Besides the while statement, Python knows the usual control flow statements known
from other languages, with some differences.
The most well-known statement type is the if statement. For example:
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1
... print 'Single'
... else:
... print 'More'
...
There can be zero or more elif parts, and the else part is optional. The elif keyword
is short for else if, and is used to avoid excessive indentation. An
if... elif... elif ... sequence is a substitute for the switch or case statements
found in other languages.
for statement
The for statement in Python differs a bit from what you may be used to in C or Pascal.
Rather than always iterating over an arithmetic progression of numbers (like in Pascal), or
giving the user the ability to define both the iteration step and halting condition (as C),
Python's for statement iterates over the items of any sequence (a list or a string), in the
order that they appear in the sequence. For example:
>>> # Measure some strings:
... a = ['cat', 'rose', 'carrot']
>>> for x in a:
... print x, len(x)
...
cat 3
rose 4
carrot 6
It is not safe to modify the sequence being iterated over in the loop (this can only happen
for mutable sequence types, such as lists). If you need to modify the list you are iterating
over (for example, to duplicate selected items), you must iterate over a copy. The slice
notation makes this particularly convenient:
....................................................................................................................................................................................................................................
6-10 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011
Introduction to Python Use Python
....................................................................................................................................................................................................................................
>>> for x in a[:]: # makes a slice copy of the entire list
... if len(x)>5: a.insert(0,x)
...
>>> a
['carrot', 'cat', 'rose', 'carrot']
range() function
If you do need to iterate over a sequence of numbers, the built-in range() function is
useful. It generates lists containing arithmetic progressions:
>>> range(5)
[0, 1, 2, 3, 4]
The given end point is never part of the generated list; range(5) generates a list of 5
values, the legal indices for items of a sequence of length 5. It is possible to let the range
start at another number, or to specify a different increment (even negative; sometimes this
is called the step):
>>> range(2, 5)
[2, 3, 4]
>>> range(0, 5, 3)
[0, 3]
>>> range(-10, -100, -30)
[-10, -40, -70]
To iterate over the indices of a sequence, combine range() and len() as follows:
>>> a = ['September', October', 'November', 'December']
>>> for i in range(len(a)):
... print i, a[i]
...
0 September
1 October
2 November
3 December
....................................................................................................................................................................................................................................
Alcatel-Lucent 9959 NPO Alcatel-Lucent Proprietary 6-11
diagug M4 Use pursuant to applicable agreements
Issue 10 March 2011
Introduction to Python Use Python
....................................................................................................................................................................................................................................
...
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
pass statement
The pass statement does nothing. It can be used when a statement is required
syntactically but the program requires no action. For example:
>>> while True:
... pass # Busy-wait for keyboard interrupt
...
....................................................................................................................................................................................................................................
6-12 Alcatel-Lucent Proprietary Alcatel-Lucent 9959 NPO
Use pursuant to applicable agreements diagug M4
Issue 10 March 2011