question

JayW avatar image
JayW asked ericnute edited

Using wildcards in the applicability fields to account for command variation.

Response Map Applicability - Using wildcards in the applicability fields to account for command variation:

 

When creating a response map it is important to understand the variations in how the command may appear in the test case. For example, a Cisco IOS command could be "show interfaces gigabitEthernet 1/0/1 stats" which would be the command in its expanded form. A shortened form of this could be "sh int gi1/0/1 stats" which would resolve to the full command when executed on the device. If you setup your response map applicability based on the expanded form of the command then you may run into circumstances where the response map is not applied to the correct responses because users are entering the shortened version of the commands. It is recommended that the "command" field for the response map applicability always be entered in the shortened format and combined with either the wildcard or regular expression functionality of that field. The applicability processing will keep trying applicable response maps (in priority order) until it finds a response map that maps without errors. It is important to note that you may want to use the priority field to control which maps should be tried first should applicability rules be similar for several response maps.

 

So, for the command above the following would be entered in the command field for response map applicability (if using a wildcard):  "sh* int* * stats" which would account for the shorten command and the possibility of entering a different interface type or number.  This of course must all be considered when actually creating the response map as you will have to account for the variation between interface types and such.

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.

1 Answer

BillS avatar image
BillS answered BillS posted

As a side note, it's very strongly recommended that any command you actually issue to a device use the full version of the command even if it accepts a shortened one. Because between versions a new command could be added which suddenly makes the old one not the only unique completion - "sh foo" might suddenly match "show foo" or "shape foo" - and suddenly you could have extra work going back to hunt down all short versions and fix 'em.

 

Not that I've ever had to do that in my scripts, and never particularly with IOS. Nu-huh. Nope. Okay maybe a lot.

 

-Bill

 

1 comment
10 |950

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

JayW avatar image JayW commented ·

lol, great point Bill!!

0 Likes 0 ·