-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.web.ajOnuMenu(Stels11)_reboot.pl
More file actions
46 lines (44 loc) · 1.61 KB
/
patch.web.ajOnuMenu(Stels11)_reboot.pl
File metadata and controls
46 lines (44 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#<ACTION> file=>'web/ajOnuMenu.pl',hook=>'menu_reboot', after=>'Ponmon'
push @menuItems, { order => 21, title => L('Перезавантаження ONU'), act=>'rebootOnuStels11' } if lc($p{vendor}) =~ 'stels11';
#<ACTION> file=>'web/ajOnuMenu.pl',hook=>'subs', after=>'Ponmon'
sub act_rebootOnuStels11 {
# 2024.08.31
# https://t.me/MrMethod
my $attr = shift;
return $ajax_url->a($lang::btn_Execute, act=>'rebootOnuStels11', go=>1) unless ses::input_int('go');
my $tc = _telnetConnect($attr);
my $res = '';
ToLog(L('Запросив Reboot ОНУ sn=[]', $attr->{sn}));
my $addr = $attr->{name};
$addr =~ s/[A-Za-z]//mgi;
$addr =~ m/(\d+)\:(\d+)$/;
my ($pon, $slot) = ($1, $2);
_tnCmd($tc, '');
my $pt = $tc->last_prompt();
$pt = $tc->last_prompt();
if ($pt !~ /\Qepon#\E\s*/) {
$res = "error prompt epon: $pt";
} else {
_tnCmd($tc, sprintf('olt %d', $pon));
#!!!!!!!! NEED Duplicate some cmd from web
$tc->cmd("olt $pon"); # DUPLICATE
#!!!!!!!! NEED Duplicate some cmd from web
my $pt = $tc->last_prompt();
my $rt = "epon(olt-$pon)#";
if ($pt !~ /\Q$rt\E\s*/) {
$res = "error prompt olt: $pt";
} else {
_tnCmd($tc, sprintf('onu %d', $slot));
my $pt = $tc->last_prompt();
$rt = "epon(olt-$pon/onu-$slot)#";
if ($pt !~ /\Q$rt\E\s*/) {
$res = "error prompt onu: $pt";
} else {
_tnCmd($tc, 'ctc reboot');
$res = 'ok';
}
}
}
_telnetClose($tc);
return $res;
}