-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.web.ajOnuMenu(Bdcom_epon)_reboot.pl
More file actions
31 lines (30 loc) · 1.36 KB
/
patch.web.ajOnuMenu(Bdcom_epon)_reboot.pl
File metadata and controls
31 lines (30 loc) · 1.36 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
#<ACTION> file=>'web/ajOnuMenu.pl',hook=>'menu_reboot', after=>['Ponmon']
push @menuItems, { order => 21, title => L('Перезавантаження ONU'), act=>'rebootOnuBdcom' } if lc($p{vendor}) =~ 'bdcom' && (lc($p{model}) =~ '33' || lc($p{model}) =~ m/^p36/i);
#<ACTION> file=>'web/ajOnuMenu.pl',hook=>'subs', after=>['Ponmon']
sub act_rebootOnuBdcom {
# 2024.08.31
# https://t.me/MrMethod
my $attr = shift;
my $sn = $attr->{sn};
$sn =~ s/[\:\-\.]//g;
$sn =~ s/(....)(?=.)/$1\./g if $attr->{pon_type} eq 'epon';
$attr->{snx} = $sn;
debug $sn;
debug('pre', $attr);
return $ajax_url->a($lang::btn_Execute, act=>'rebootOnuBdcom', go=>1) unless ses::input_int('go');
my $tc = _telnetConnect($attr);
_tnCmd($tc, "\n");
ToLog(L('Call reconfOnuBdcom [] sn=[]', $attr->{reconfType}, $sn));
debug $tc->last_prompt();
if ($tc->last_prompt() =~ m/\#$/) {
_tnCmd($tc, "epon reboot onu mac-address $sn");
$tc->waitfor('Are you sure to reboot the ONU(y/n)?');
_tnCmd($tc, "y");
_tnCmd($tc, "exit");
$attr->{reconf}{ok} = "$attr->{reconfType} sn=$sn";
} else { $attr->{reconf}{err} = "not in 'enable' mode"; }
_telnetClose($tc);
return $attr->{reconf}{err} if defined $attr->{reconf}{err};
return $attr->{reconf}{ok} if defined $attr->{reconf}{ok};
return "Backend not defined";
}