Variable Manager
The Variable Manager provides the ability for an activity author to add dynamic capabilities into an activity. These capabilities allow an author to create activities that change each time they are loaded or reset. This capability is enabled by creating pools of values and then creating variables which use the pool values to enable dynamic capabilities. The variables allow you to change many aspects of an activity, including but not limited too, Device names, IP addressing, Routing statements, DHCP and DNS records.
There are four types of variables that can be created in the Variable Manager and they are Seeds, Number, Strings and IP Addresses. With the exception of the Seeds, the variables are created using a combination of a resource pool and an associated variable. Each type tab has a place to enter both the pool and the variable information. The seeds tab, due to the simplicity of the type combine both parts into one operation.
You can set variables to select values in one of 4 ways. From drop-down menu if you select Random then the value will be selected randomly from any values in the pool. By selecting Element Position the value will be an integer that selects the same position from the pool each time. Seed refers to a position defined by a Seed variable in the Seed tab. This is a method for allowing the same position to be used in multiple variable selections. Entire Range is a variable used in the Activity Wizard answer network to accept any input as correct as long as it is contained in the associated pool. The typical sequence for creating a variable is:
An important setting to notice is the Show Variable Manager Interface at the bottom of the screen. By checking this checkbox you can set or assign variables in the Instructions text, Assessment Items, and Initial Items. You can add all of the variables created by clicking on the Arrow (<--) next to the variable name. In the Instructions panel, place the cursor where you want the variable to be placed at and then click on the Insert "<--" button in the Variable Manager Interface. In the Assessment Items and Initial Items, only the items marked with a green dot can be assigned a variable. To remove an assignment of the variable, select the appropriate variable and hit Delete on the keyboard.
Seeds
Seed values should be thought of as Index values for selecting other data variables, while not required. Make sure the pool range in greater or equal to the Seed range of values. Valid Seed range is from 0 to 2,147,483,647. A seed should be a positive value, although negative values are legal, otherwise using them as indexes in other variable pools and variables can cause unpredictable results.
To add Seeds you should fill in the required fields like Name, Minimum (usually "0") and Maximum Values by clicking on each cell of table and typing in. The maximum value should match the total number of pool entries that the seed is used to select. If left blank, both values are set to zero (0), so the first value in any pool is always selected.
Inserting the Test Value is optional and will specify the value to be used for the seed. This overrides random selection and is only used during Test Activity mode. If a value is specified in the Test Value cell, it is used during any subsequent testing or running of the activity, until the value in the cell is deleted or changed. To test all combinations simply increment the value in the Test Value cell until you have reached the value specified in the Maximum cell.
For Edit entire rows just like Adding new Seed you can double-click in the cell and change the value and to Remove click anywhere in the row to be deleted and press the Delete key. So to delete a value in the Variable Manager tables you must select and highlight the value, then delete. Do not just click in the cell of the value you want to delete, because if you press delete after just selecting the cell and not the actual value, you will delete the entire row in the table.
Seed values can be placed anywhere in Packet Tracer that a variable is accepted, in the Initial Network, the Answer Network, the Instructions, as well as Device names and Notes on the workspace. The format for using a seed is the same as for any variable, using two braces to open and close with the seed name in between the braces like this [[Index1]]. This is the same format that is used when Seeds are used in other pools or variables setup. The value that is selected from the seed range will be displayed or used in other variable selections.
Number
Number Values enable the ability to add dynamic numbers into a PT scenario. These are often used like the graphic shows, creating a range of numbers that can be concatenated and used as IP addresses. An example of how that would be done would be to use the four variables created like this [[Oct1]]. [[Oct2]]. [[Oct3]]. [[Oct4]].
Numeric variables may be used in String and IP address pools using the [[Variable]] format after they have been created on the Number page.
Number Pools:
To Add Number Pools: fill in the required Name, Minimum and Maximum Values. You can edit entire rows of Number Pools by double-click on the cell and change the value and for removing click anywhere in the row to be deleted and press the Delete key. Valid numbers range is positive and negative integer. But remember to not use negative numbers as selection or index variables. Both of these values are required or the entry will not remain in the table. Seed variables can also be substituted for integers by using this format: [[variablename]].
To Edit a Pool: just click in the cell and type a new value or new name.
To Remove a Pool value: Highlight the contents of any cell in the row and press the "Delete" Key, it you just click on the cell and delete the entire row will be deleted and any associated number variables will be deleted also.
To Remove a Pool (an entire row in the table): click on a cell in the row and press delete. The entire row will be deleted and any number variables using this Pool Name will be deleted also.
Number Variables:
After the number Pool has been created a variable can be created to use with the pool by entering a Variable Name, selecting a Pool Name from the dropdown list, and then specifying a Value Type from its dropdown list. The four choices are:
Random: Select any value from the pool choices
Element Position: Will select the Pool value as the specified position for the variable
Seed: Will select the Pool value specified by the resolved Seed variable value
Entire Range: Used in the Answer Network, any value entered into the AW Answer Tree that is included in the Pool will be considered correct.
If Element Position or Seed is specified, the associated integer value or Seed name must be entered in the Value cell. In the graphic above the Oct1 variable would resolve to a value of between 198 to 210 inclusive, based on the table and variable values. You can double-click in the cell and change the value or reselect the dropdowns values. Clicking anywhere in the row and press the Delete key will cause the cell be deleted.
Strings
String Pools can be used to create different names for devices in the Packet Tracer activity, or again like Seeds and Numbers anywhere a variable can be used. Text variables can also be used in the instructions area to change the scenario text. Since Packet Tracer initially converts every to strings, text strings can also be used for IP addresses like the IP octet pool shows.
String variables may be used in IP Address Pools, using the [[Variable]] format.
String Pool:
To Add a Pool: Fill in the required Name and Text Field. The Text field can contain text, numbers, Seeds and Number Variable data, separated by semi-colons. Seed and Number variables can be substituted for text data using [[variablename]].
To Edit a Pool: Select and highlight the text to be change and type over it.
To Remove a Pool value: Select and highlight the text, then press the "Delete" Key,
To Remove a Pool (an entire row in the table): click on a cell in the row and press delete. The entire row will be deleted and any number variables using this Pool Name will be deleted also.
String Variables:
You can also add String Variables by filling in the required Name, Pool Name and Value type field. If Value Type is Element Position, an integer value or Number Variable is specified in the value field. In case of Value Type is Seed, a Seed variable name is used in the Value field. See also Number Variables.
IP Addresses
IP address pools allow for dynamic addressing schemes in Packet Tracer, they also allow for dynamic configurations in the initial network including DNS and DHCP records. They also allow for multiple correct answers, for example in addressing schemes, when used in the answer network.
IP Address Pool:
To Add a pool: Fill in the required Name, Network Address, and Mask Values. The First and Last IP Address fields will automatically filled in based on the Network and Mask fields, although they can be manually changed to the specific range of addresses needed. Seed, Number, and String variables can be substituted for address data using [[variablename]].
To Edit a Pool: Double-Click in the cell and change the value. The First and Last IP Address fields can be edited to specify a smaller range of addresses that is set by default.
To Remove: Click anywhere in the row to be deleted and press the Delete key
IP Address Variables:
To Add IP Address Variable fill in the required Name, Pool Name and Value type fields. If Value Type is Element Position, an integer value or Numeric Variable is specified in the value field. If Value Type is Seed, a Seed variable name is used in the Value field. Editing and removing any rows is just like IP Address Pool. See also Number variables.
Using Regular Expressions
An alternative to using the conventional variables in the Variable Manager is to use regular expressions to check dynamic assessment items like default gateway or IP addresses. Instead of assigning a variable in the assessment items tree to an assessment item as described in the previous section, you may insert a regular expression. The syntax to use a regular expression in Activity Wizard is {{RegEx:expression}}. For example, the following is a valid regular expression to check if an IP address is in the 192.168.1.0 network:
{{RegEx:\b(192?)\.(168?)\.(1?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b}} |
You would then insert the regular expression in replacement of a variable in assessment items tree by selecting the assessment item (e.g. IP Address) and clicking once more on the current value of the assessment item (e.g. 0.0.0.0) such that field would becomes editable. Once the field is editable, you can type in the regular expression and pressing Enter after you are done.
For more help with regular expressions, visit the Qt QRegExp documentation here: