Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

Network Change & Configuration Management

Reply
Highlighted
Accepted Solution

Problem with trigger template and "/" in text

[ Edited ]
Authority
Posts: 21
3009     0

Hello,

I try to extract from "show ver" output path to image file and image name. I prepared trigger variables and template but it doesn't work. I'm using tool (https://NetMRI/netmri/ccs/tx/regex_test/index.tdf) for validation but I receive strange results (sreenshot attached). Below are data put into validation tool.

 

Trigger-Variables:
$currentbootimage    /[\w\.\-]+\.bin/
$path    /flash:(\/\w+\/?)*/

Trigger-Template:
[[$path]][[$currentbootimage]]\S

Device Output:
Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(55)SE10, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compiled Wed 11-Feb-15 11:46 by prod_rel_team
Image text-base: 0x00003000, data-base: 0x01900000

ROM: Bootstrap program is C2960 boot loader
BOOTLDR: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(53r)SEY3, RELEASE SOFTWARE (fc1)

SWITCH uptime is 1 day, 5 hours, 13 minutes
System returned to ROM by power-on
System restarted at 07:45:41 CEST Sun Oct 2 2016
System image file is "flash:/waw/qwer/c2960-lanbasek9-mz.122-55.SE10.bin"

 

Why variable $currentbootimage shows part of the path instead image name? When I put :

Trigger-Template:
flash:flash:(\/\w+\/?)*[[$currentbootimage]]

Trigger works, but I need information about path.

Thank you

Darek

Highlighted

Re: Problem with trigger template and "/" in text

Adviser
Posts: 431
3010     0

 

Variables:

$currentbootimage /[\w\.\-]+.bin/
$path /\w*:\/\w*\/\w*\//

 

Template:

[[$path]][[$currentbootimage]]

 

 

 1.1. Trigger: 'Regular Expression Test Trigger' Output: 'Regular Expression Test Action'  
 09:39:05   Trigger-Template 
 09:39:05     Template matches 
 09:39:05   
 (flash:/waw/qwer/)(c2960-lanbasek9-mz.122-55.SE10.bin) 
 09:39:05   Trigger-Variables 
 09:39:05     $path = 'flash:/waw/qwer/' 
 09:39:05     $currentbootimage = 'c2960-lanbasek9-mz.122-55.SE10.bin' 

 

 

Let me know if this works for you

 

Sif

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

www.sifbaksh.com
Showing results for 
Search instead for 
Do you mean 

Recommended for You