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

Perl script for ASR9K with satellite

mcagiola
Cisco Employee
Cisco Employee

Hi all, i need a little help on a perl script used on ASR9K:

my $n_args = $#ARGV + 1;

if ($n_args != 1) {

    print "Usage: showmac <bridge-group>\n";

    exit;

}

 

my $bgroup=$ARGV[0];

my $cli_output = `nvgen -c -q gl/l2vpn/dbase/vpls_bridge/$bgroup/`;

(my $bdomain) = $cli_output =~ m/\s+bridge-domain\s(.*)/;

my $cli_output = `l2vpn_show -g $bgroup 0x9`;

(my $mod) = $cli_output =~ m/\s+\w+\d\/(\d)\/\d\/\d.*/;

 

# Magic happens here

if ($mod == 0) { $mod = 2049; }

if ($mod == 1) { $mod = 2065; }

if ($mod == 2) { $mod = 2081; }

if ($mod == 3) { $mod = 2097; }

if ($mod == 4) { $mod = 2145; }

if ($mod == 5) { $mod = 2161; }

if ($mod == 6) { $mod = 2177; }

if ($mod == 7) { $mod = 2193; }

 

my $cli_output = `l2fib_show_client -l $mod -BrigeDomain $bgroup:$bdomain -macAddress`;

 

my @values = split("\n", $cli_output);

foreach my $line (@values) {

  if ( !($line =~ m/MAC/ || $line =~ m/l2vpn/ || $line =~ m/.*BD.*/) ) {

    print $line."\n";

  }

}

This script release the output like this:

RP/0/RSP0/CPU0:XXXX001#run perl /harddisk:/scripts/showbmac.pl XXX_XXXX

Wed May 31 09:42:56.141 CET

 

Mac Address    Type    Learned from/Filtered on    LC learned Resync Age         Mapped to    

------------------------------------------------------------------------------------------

ac60.b675.6fe3 dynamic Gi0/0/1/0.3915              0/0/CPU0   0d 0h 0m 2s        N/A          

044e.06c9.f092 dynamic Gi0/0/1/1.3915              0/0/CPU0   0d 0h 0m 17s       N/A          

044e.06ce.f8a0 dynamic Gi0/0/1/1.3915              0/0/CPU0   0d 0h 0m 15s       N/A          

044e.06ce.fa8a dynamic Gi0/0/1/1.3915              0/0/CPU0   0d 0h 0m 19s       N/A          

[SNIP]      

9038.090a.131f dynamic Te0/2/0/0.3915              0/2/CPU0   0d 0h 0m 14s       N/A          

9038.0946.58d5 dynamic Te0/2/0/0.3915              0/2/CPU0   0d 0h 0m 13s       N/A          

9038.0973.67ce dynamic Te0/2/0/0.3915              0/2/CPU0   0d 0h 0m 11s       N/A          

Now the problem is that: if I use the same script in a device with satellite installed on it, I have NO results:

RP/0/RSP0/CPU0:xxxxx002#run perl /harddisk:/scripts/showbmac.pl xxx_xxxxx

Wed May 31 09:48:09.747 CET

even if I should have the same results on that device.

The only difference on those devices is that one of those have a satellite installed on it… I need to modify the script to show the results also if the device have satellite installed on it.

The satellite interface are named:

 

Gi100/0/0/<ID>

 

Can anyone help me?

 

Thanks In advance.

 

Marco

1 Reply 1

Aleksandar Vidakovic
Cisco Employee
Cisco Employee

hi Marco,

neat approach to changing the look and feel. Have you tried printing the output at various steps (especially before and after the magic with the 'mod')? That should give some hints.

/Aleksandar

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: