Working with Patterns

 

Patterns allow developers to define the format in which the parameters appear in real-time. This feature is mostly used by developers to model the Access Identifiers which denote the actual components in an NE. These AID patterns are contained within a pattern set and a pattern set can contain multiple patterns.

 

Since AID modelling is done based on Input Messages (and not vice versa), the Input Messages have to be associated with the Pattern Set. Once the association is made, data is created strictly based on these patterns.

 

The pattern contains the following entries:

 

Name

Description

Pattern Name

A name that identifies a pattern. Typically it represents a component in an NE.

Category

Category to which the particular pattern belongs to. Useful when displaying the AID pattern hierarchy in message tree.

Pattern

A string representing an AID pattern.

Condition

A condition string in a specified format shown below. This is used as an alternative for pattern.

Interface

An implementation of PatternMatcher interface available in the com.adventnet.tl1.commandset package.

 

Following are the keywords to be used to build a condition expression.

 

Entity

Description

contains::<str>

Check if the value string contains <str>.

!contains::<str>

Check if the value string does not contain <str>.

equals::<str>

Check if the value string matches <str>.

!equals::<str>

Check if the value string does not matches <str>.

indexof[<start>*<end>]::<str>

Check if the value string matches with <str> starting from the position specified in <start>.

!indexof[<start>*<end>]::<str>

Check if the value string does not match with <str> starting from the position specified in <start>.

startswith::<str>

Check if the value string starts with <str>.

!startswith::<str>

Check if the value string does not start with <str>.

endswith::<str>

Check if the value string ends with <str>.

!endswith::<str>

Check if the value string does not end with <str>.

 

Example of TL1 patterns:

 

1. (startswith::ST1)

2. ((endswith::ST1)$$(contains[0*3]::-))

3. ((startswith::OC)||(endswith::5))

4. (equals::ALL)

5. (indexof[0*10]::OC)

6. (((startswith::ST1)&&(endswith::1))||(equals::ST1-1))

7. ((startswith::ST)||(startswith::ST1)||(endswith::5))

 

To Create a Pattern Set,

 

  1. Load a Command Set file. Traverse the message tree and select Templates -> PatternSet. Right-click on the Pattern Set node and select Add Pattern Set.

  2. A Create New Pattern Set dialog pops up. Specify the pattern set name and click the OK button. The pattern set name is added to the message tree under Pattern Set.

  3. Now, select the pattern set name. The right-panel displays an empty table. Right-click and select Add Pattern. A Create New Pattern dialog is invoked.

  4. Specify the pattern name, Category, Pattern, Condition, and Interface fields for that pattern. Click the OK button. A row is created and the pattern details are displayed.

  5. Click the Save button to save the pattern details to the command set file.

 

Add Pattern

 

The pattern details are specified in the right panel as shown in the image. A Pattern Set can contain any number of patterns. If multiple patterns are defined, the parameter value string is validated for each pattern defined in that pattern set.

 

Pattern Set

 

Once pattern sets are created, they must be associated with appropriate parameters for validating against pattern set.

 



Copyright © 1996-2006, AdventNet Inc. All Rights Reserved.