cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1603
Views
0
Helpful
1
Replies
Beginner

Request - Perl script that can parse an ACE config from a VIP

Has anyone ever written a Perl script that can take the VIP from an ACE config and parse it out into the component parts of the config, ACLs, NATs, Class-map, policy-map, etc. ?

This seems like something someone must have written already.

Thanks in advance!

1 REPLY 1
Highlighted
Cisco Employee

Re: Request - Perl script that can parse an ACE config from a VI

Any reason you dont want to use XML instead of doing just PERL ?  Its lot easier to do with XML scripts as ACE has a XML interface to query whatever is needed. So that said, you can use a perl to interface ACE via XML. Here's a simple Perl that uses LibCurl:

#!/usr/bin/perl
use WWW::Curl::Easy;

my $numArgs = $#ARGV + 1;
if ($numArgs<4)
{
die("Usage: shusers.pl ip_address username password command\n");
}
my $ip = @ARGV[0];
my $uname = @ARGV[1];
my $pwd = @ARGV[2];
my $cmd = @ARGV[3];
my $curl = new WWW::Curl::Easy;
my $posturl = "http://$ip/bin/xml_agent/";

my $xml_cmd = "xml_cmd=<$cmd/>";

$curl->setopt(CURLOPT_HEADER, 0);
$curl->setopt(CURLOPT_FRESH_CONNECT, 1);
$curl->setopt(CURLOPT_URL, $posturl);
$curl->setopt(CURLOPT_RETURNTRANSFER,1);
$curl->setopt(CURLOPT_USERPWD,"$uname:$pwd");
$curl->setopt(CURLOPT_POST,1);
$curl->setopt(CURLOPT_POSTFIELDS, $xml_cmd);

$curl->perform;

my $info = $curl->getinfo(CURLINFO_RESPONSE_CODE);
print $info;

Hope this helps.

Cheers

V.K