Discussion:
[rancid] filtering of show license
Václav Ovsík
2016-07-11 12:29:06 UTC
Permalink
Hi,
with Rancid 3.4.1 a new information is digged from IOS using
show license
but it contains relative (changing) time :-/ e.g.:

Index 3 Feature: securityk9
Period left: 5 days 7 hours
Period Used: 7 weeks 5 days

have anybody already solved this? (change to end-of-license time or so)
Thanks
--
Zito
Václav Ovsík
2016-07-11 14:01:56 UTC
Permalink
Post by Václav Ovsík
Hi,
with Rancid 3.4.1 a new information is digged from IOS using
show license
Index 3 Feature: securityk9
Period left: 5 days 7 hours
Period Used: 7 weeks 5 days
have anybody already solved this? (change to end-of-license time or so)
for this time I added only removing:

@@ -587,6 +587,7 @@
return(0) if (/% license not supported on this device/i);# show lic on old box
return(1) if (/Line has invalid autocommand /);
return(1) if (/(invalid (input|command) detected|type help or )/i);
+ s/^(\s*Period (?:left|used)):(?:\s*\d+\s*(?:weeks|days|hours))+/$1: <removed>/i;

ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
}
--
Zito
Václav Ovsík
2016-07-12 07:42:40 UTC
Permalink
Post by Václav Ovsík
Post by Václav Ovsík
Hi,
with Rancid 3.4.1 a new information is digged from IOS using
show license
Index 3 Feature: securityk9
Period left: 5 days 7 hours
Period Used: 7 weeks 5 days
have anybody already solved this? (change to end-of-license time or so)
@@ -587,6 +587,7 @@
return(0) if (/% license not supported on this device/i);# show lic on old box
return(1) if (/Line has invalid autocommand /);
return(1) if (/(invalid (input|command) detected|type help or )/i);
+ s/^(\s*Period (?:left|used)):(?:\s*\d+\s*(?:weeks|days|hours))+/$1: <removed>/i;
ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
}
singular too :-/

--- ios.pm.orig 2016-05-18 08:09:10.000000000 +0200
+++ ios.pm 2016-07-12 09:35:02.552000000 +0200
@@ -587,6 +587,7 @@
return(0) if (/% license not supported on this device/i);# show lic on old box
return(1) if (/Line has invalid autocommand /);
return(1) if (/(invalid (input|command) detected|type help or )/i);
+ s/^(\s*Period (?:left|used)):(?:\s*\d+\s*(?:weeks?|days?|hours?))+/$1: <removed>/i;

ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
}
--
Zito
heasley
2016-07-14 09:46:47 UTC
Permalink
Post by Václav Ovsík
Post by Václav Ovsík
Post by Václav Ovsík
Hi,
with Rancid 3.4.1 a new information is digged from IOS using
show license
Index 3 Feature: securityk9
Period left: 5 days 7 hours
Period Used: 7 weeks 5 days
have anybody already solved this? (change to end-of-license time or so)
@@ -587,6 +587,7 @@
return(0) if (/% license not supported on this device/i);# show lic on old box
return(1) if (/Line has invalid autocommand /);
return(1) if (/(invalid (input|command) detected|type help or )/i);
+ s/^(\s*Period (?:left|used)):(?:\s*\d+\s*(?:weeks|days|hours))+/$1: <removed>/i;
ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
}
singular too :-/
--- ios.pm.orig 2016-05-18 08:09:10.000000000 +0200
+++ ios.pm 2016-07-12 09:35:02.552000000 +0200
@@ -587,6 +587,7 @@
return(0) if (/% license not supported on this device/i);# show lic on old box
return(1) if (/Line has invalid autocommand /);
return(1) if (/(invalid (input|command) detected|type help or )/i);
+ s/^(\s*Period (?:left|used)):(?:\s*\d+\s*(?:weeks?|days?|hours?))+/$1: <removed>/i;
ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
}
Does this also solve the problem for you:

Index: lib/ios.pm.in
===================================================================
--- lib/ios.pm.in (revision 3291)
+++ lib/ios.pm.in (revision 3300)
@@ -458,6 +458,7 @@
while (<$INPUT>) {
tr/\015//d;
goto OUT if (/^$prompt/); # should not occur
+ s/\s*$//; # trim trailing WS
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
my($len) = length($1);
@@ -540,9 +541,16 @@
next if (/^\s+\^$/);
return(0) if (/% no licensable udi in the system/i); # show udi on old box
return(0) if (/% license not supported on this device/i);# show lic on old box
+ return(0) if (/% incomplete command/i); # show lic on old XE box
return(1) if (/Line has invalid autocommand /);
return(1) if (/(invalid (input|command) detected|type help or )/i);

+ next if (/period used:/i);
+ if (/(^\s*period left:\s*)\d+/i) {
+ ProcessHistory("COMMENTS","keysort","LICENSE","! $1<limited>\n");
+ next;
+ }
+
ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
}
ProcessHistory("COMMENTS","keysort","LICENSE","!\n");

Loading...