4.3 Record/Playback

The record/playback functionality allows you to record a series of Web service calls and play them back at a future time. To start the recorder, enter /r at any data entry prompt. The recorder prompts for a file name in which subsequent calls are recorded and then it returns to the data entry prompt.

Until the recorder is stopped, Web service request and reply data is stored as an XML stream to the specified file. You can manually edit these files, but you should be careful to avoid breaking the file structure. For example, this is a recording of a getElement request:

<object-stream>
  <com.netiq.wsapi.client.services.interactive.IAGetElementSvc>
    <__session>
      :    :    :
    </__session>
<__dname> root=Elements</__dname>
    <__inclusionSpec>
      <childDepth>0</childDepth>
      <forceDiscovery>false</forceDiscovery>
      <includeLeftElements>false</includeLeftElements>
      <includeRightElements>false</includeRightElements>
      <____hashCodeCalc>false</____hashCodeCalc>
    </__inclusionSpec>
    <__contentSpec>
      <includeIconInfo>false</includeIconInfo>
      <includeOperationInfo>false</includeOperationInfo>
      <includePropertyValues>false</includePropertyValues>
      <includeSeriesInfo>false</includeSeriesInfo>
      <includeSlas>false</includeSlas>
      <optionalAttributeNames/>
      <____hashCodeCalc>false</____hashCodeCalc>
    </__contentSpec>
    <__throttle>
      <maxRecords>0</maxRecords>
      <____hashCodeCalc>false</____hashCodeCalc>
    </__throttle>

You can safely change the content of a field such as <__dname> or <maxRecords>, but adding or removing other fields might cause deserialization errors during playback.

It is important to understand that the recorder looks only at Web service calls, not the user interactions that produced the call. If the recorder is running when you play back a script, the calls generated from the script player are also recorded in the current script file. You cannot play back a script that is currently being recorded.

After starting the script player, you are prompted to enter the script file name. If the player can find and read the specified file, the player issues the Web service calls recorded in the script file, sending each request (almost) verbatim. The script player does not use WsSession objects from the recording. Instead it uses session information from the current context.

When you play a recorded script, the script player inherits a copy of the current context (current session, if any, current post processor settings, etc.). Any changes to the context, such as opening a new user session, are only applied to the context copy and are lost when the playback is complete.

The only other case where a playback request differs from the recorded script is the cursor value when you play back a next-type request (nextAlarms, nextElements, etc.). Because cursor values are session-specific, sending a cursor value recorded in another session always fails. Instead, these services use the last cursor value returned for that type of query.

This feature depends on CacheBuilderPostProc being enabled. If it is disabled, the playback either returns the latest appropriate entry in the cache, or if there is none, it uses the recorded cursor value. In either case, the playback probably does not produce the expected results.

During playback, response data in the recording is compared with the playback response, and a detailed analysis is written to the display and a log file (scriptFileName.log). Here is a sample playback analysis of the script shown above:

Service: Select from menu (1 needed): /p
Enter file name: get.scr
= 1-getElement.elementResultSet.element[Elements(1)].dName:root=Elements
= 1-getElement.elementResultSet.element[Elements(1)].className:root
= 1-getElement.elementResultSet.element[Elements(1)].condition:CRITICAL
= 1-getElement.elementResultSet.element[Elements(1)].displayName:Elements
= 1-getElement.elementResultSet.element[Elements(1)].notes
= 1-getElement.elementResultSet.element[Elements(1)].parentDName
! 1-getElement.elementResultSet.element[Elements(1)].lastUpdate:74/15:1:0->74/15:23:34
! 1-getElement.elementResultSet.element[Elements(1)].tempId:1173976147->1173990162
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Element]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Condition]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Last Reported]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Algorithm]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Algorithm Parameters]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Algorithm Disseminates]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Root Cause]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Root Cause Tree]
= 1-getElement.elementResultSet.element[Elements(1)].attrName[Impacted]
- 1-getElement.elementResultSet.element[Elements(1)].
leftrelationshipInfo[STATIC:test(1)].relatedDName:org=test/root=Generational+Models/root=Services
+ 1-getElement.elementResultSet.element[Elements(1)].leftrelationshipInfo
[STATIC:global(1)].relatedDName:org=global/root=Organizations
= 1-getElement.elementResultSet.cursor
= 1-getElement.elementResultSet.remainingElementCount:0
Playback of get.scr complete

Each line of the analysis corresponds to a single data value in the response. The first character of each line indicates the analysis results, as described in Table 4-3.

Table 4-3 First Line Characters

Character

Indicates…

=

The value has not changed.

!

The value has changed. When this indicator is used, both the recorded value and the playback value are shown separated by ‑> (hyphen followed by greater than symbol).

+

A value in a list (an array) was present in the playback, but not in the recording.

-

The value in a list was present in the recording but not in the playback.

To analyze the meaning of the values in a line, look at the following example:

= 1-getElement.elementResultSet.element[Elements(1)].condition:CRITICAL

Table 4-4 describes the line characters used in this example.

Table 4-4 Line Characters

Sample Characters

Meaning

=

Indicates the analysis results. An equal sign = means the value is unchanged.

1

A number indicating sequence number of the message in the script being played. The number 1 identifies the first message in the script.

getElement.elementResultSet

The request type. This example looks at the result set from a getElement query.

.element[Elements(1)]

The response field. This example specifies the element field in the elementResultSet. Since element is actually an array of elements, the name is subscripted with square brackets [ ]. The value inside the brackets varies by the array type. For elements, it is the displayName of the element. However, because displayName is not unique (and DName is too long to produce readable output) the displayName is subscripted with parentheses ( ) containing the instance number of that displayName in this list.

.condition:

Specifies the field name within the element.

CRITICAL

Specifies the value of the field above.