question

AmeyaB avatar image
AmeyaB asked

HOW TO: Response Map a table whose columns have spaces and are multiple widths

Assume a scenario where the device returns a CLI response that contains the following table:

Port     Description  Status Speed      Duplex Vlan 
Fo 0/0                Down   40000 Mbit Auto   --
Fo 0/4   ** Tom       Up     40000 Mbit Full   --
Fo 0/8   ** Jane      Down   40000 Mbit Auto   --
Fo 0/12               Down   40000 Mbit Auto   --
Te 0/16  ** Harry     Down   10000 Mbit Auto   --

As the content of the Description column includes spaces, we cannot use spaces to delineate columns when we identify this table in the Response Map, and instead we use column widths to specify the columns.

Now, what happens if in a later version, the device returns the following table instead:

Port     Description           Status Speed      Duplex Vlan 
Fo 0/0                         Down   40000 Mbit Auto   --
Fo 0/4   ** Tom owns this      Up     40000 Mbit Full   --
Fo 0/8   ** John owns this     Down   40000 Mbit Auto   --
Fo 0/12                        Down   40000 Mbit Auto   --
Te 0/16  ** Harry owns this    Down   10000 Mbit Auto   --

Notice that the overall format of the table is the same; the only difference is that the column width of the Description column is now bigger. In this case how can you modify the earlier Response Map to account for both tables – while ensuring the original set of queries return correct value depending on which table is in the response?

The trick is to treat both the tables as separate tables and teach iTest how to locate the tables using the column headers. So in the Response Map, you would have 2 tables with the following values in the table/Locating Table/Start/Banner Contains field:

Table 1: Port     Description  Status Speed      Duplex Vlan 
Table 2: Port     Description           Status Speed      Duplex Vlan 

This allows iTest to correctly identify which ever table is sent back by the response. For each of these tables, you would specify the correct (and different) column widths.

See the attached response map for an example.

table-with-column-spaces-and-multiple-widthsffrm.zip

iTestresponse map
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.