#!/usr/bin/perl
use warnings;
use strict;
use Net::SSH2;
use IO::File;
my $host = '77.39.84.16';
my ($user) = 'av_bondarchuk';
my ($password) = '314MyP753';
open my $log, '>>', "log.txt" or die "can't open logfile: $! ";
open my $counts, '>>', "counts.txt" or die "can't open counts: $! ";
my $cmds = 'show vpls mac-table count instance PPPoE-STV-ATS24';
my @commands = $cmds;
my $ssh2 = Net::SSH2->new();
$ssh2->connect($host) or die "Can not connect to $host $@ \n";
$ssh2->auth_password($user, $password) or die "Can not login with $user/$password\n";
my $i = 1;
foreach my $cmd (@commands)
{
my @out = $ssh2->cmd($cmd);
print @out;
print $log @out;
foreach my $line (@out)
{
if ($line =~ /^(\d+)(?= MAC address learned)/)
{
print $counts $host.": ".$i.",".$1."\n";
$i++;
}
}
}
print 'done';
close($log);
close($counts);
close($cmds);
use warnings;
use strict;
use Net::SSH::W32Perl;
my $host = '255.255.255.255';
my ($user) = 'admin';
my ($pass) = 'admin';
my $ssh = Net::SSH::W32Perl->new($host, debug => 1, ) || die $!;
$ssh->sock;
$ssh->login($user, $pass);
use Net::Telnet;
use IO::File;
open my $IPlist, '<', "iplist.txt" or die "can't open iplist: $!";
my $username = 'admin';
my $passwd = 'admin';
my ($ena)='enable';
my ($conf)='conf t';
my ($command1)='hostname R2D2';
my ($command2)='exit';
my ($command3)='wr mem';
$t = new Net::Telnet (Timeout => 10, Telnetmode => 1, Input_Log => "infile.log", Output_log => "output.log",);
while (<$IPlist>)
{
$t->open("<$IPlist>");
$t->waitfor('/login:$/i');
$t->print($username);
$t->waitfor('/Password:$/i');
$t->print($passwd);
$t->print ("$ena");
$t->print ("$conf");
$t->print("$command1");
$t->print("$command2");
$t->print("$command3");
$t->print("$command2");
}
Для RX enterprises.27514.100.30.1.1.17.х
Для TX enterprises.27514.100.30.1.1.22.x
где х - номер интерфейса
Доверия их документации нет, т.к. много чего описанного там по факту нет на оборудовании, либо работает криво, но в этом случае повезло