cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

EEM making a script more dynamic and automated

246
Views
0
Helpful
0
Comments
Enthusiast

Hello!

I'm looking for a way to make my EEM script more dynamic and automated for my environment.  This is what I have - basically I just capture the 4 IPSec peer IP addresses of each neighbor and insert this data into 4 different variables.

 

cli command "show crypto session | i port"

string range "$_cli_result" 6 20

regexp "[0-9]+" "$_string_result" IP1

string range "$_cli_result" 24 60

regexp "[0-9]+" "$_string_result" IP2

puts "IP1=$IP1"

puts "IP2=$IP2"

etc.

etc.

etc.

 

Script output:

IP1=10.0.3.1

IP2=10.0.2.1

IP3=20.0.3.1

IP4=20.0.2.1

 

My configuration is manually set for the 4 neighbors I currently have setup and I guesstimate the IP address space required (Eg. 192.168.100.111 verses  10.0.1.1).  If the IP address is not 3 full values per octet, some strings could be off.

 

Also, I would like to cycle through the   "show crypto session | i port"   cli command output and dynamically figure out how many neighbors I have instead of my current manual method of hard setting this configuration in the script.

 

ANY HELP would be greatly appreciated.

Thank you

Frank

 

Content for Community-Ad