Skip to content

How to handle minor variations (is it possible to do "if")? #237

Open
@joubbi

Description

@joubbi
  • Documentation Report

I am creating templates for some Cisco IOS devices.
Unfortunately Cisco is not consistent with the output on some of their commands across IOS versions and devices.

For example the command "show vtp status" outputs:

VTP version running             : 2

on some switches. And this on others:

VTP Version                     : 2

Is it possible to handle this with an if statement or or?
(regexp like this, if null then regexp like this instead).
Or something similar to this:

pattern_match:
    regex: "VTP Version capable             : (.*)" | "VTP Version                     : (.*)"

Also the amounts of whitespace between names and variables differ on different devices:

Number of existing VLANs          : 34
Number of existing VLANs        : 8

I haven't found any examples or documentation on how to handle these situations.

EDIT:
I solved this particular problem with this regex:

regex: "VTP \\Sersion [r|\\s][u|\\s][n|\\s][n|\\s][i|\\s][n|\\s][g|\\s]             : (.*)"

Still I would like to know if there is a possibility to do an if statement.
Also more documentation would be very helpful.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions