Skip to content

Commit

Permalink
Removed support ctrl_port_descr on FD16xx FW3
Browse files Browse the repository at this point in the history
  • Loading branch information
meklis committed Aug 1, 2024
1 parent 087b072 commit df4539a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
6 changes: 3 additions & 3 deletions configs/models/C-Data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ models:
ctrl_ont_descr: \SwitcherCore\Modules\CData\FD16xxV3\CtrlOntDescription
console_command: \SwitcherCore\Modules\CData\FD16xxV3\RawConsoleCommand
multi_console_command: \SwitcherCore\Modules\CData\FD16xxV3\MultiRawConsoleCommand
ctrl_port_descr: \SwitcherCore\Modules\CData\FD16xxV3\PortDescriptionControl
#ctrl_port_descr: \SwitcherCore\Modules\CData\FD16xxV3\PortDescriptionControl
ctrl_ont_delete: \SwitcherCore\Modules\CData\FD16xxV3\OntDeleteGpon
uni_interfaces_status: \SwitcherCore\Modules\CData\FD16xxV3\OntUniPortsStatus
unregistered_onts: \SwitcherCore\Modules\CData\FD16xxV3\UnregisteredOnts
Expand Down Expand Up @@ -473,7 +473,7 @@ models:
ctrl_ont_descr: \SwitcherCore\Modules\CData\FD16xxV3\CtrlOntDescription
console_command: \SwitcherCore\Modules\CData\FD16xxV3\RawConsoleCommand
multi_console_command: \SwitcherCore\Modules\CData\FD16xxV3\MultiRawConsoleCommand
ctrl_port_descr: \SwitcherCore\Modules\CData\FD16xxV3\PortDescriptionControl
#ctrl_port_descr: \SwitcherCore\Modules\CData\FD16xxV3\PortDescriptionControl
ctrl_ont_delete: \SwitcherCore\Modules\CData\FD16xxV3\OntDeleteGpon
uni_interfaces_status: \SwitcherCore\Modules\CData\FD16xxV3\OntUniPortsStatus
unregistered_onts: \SwitcherCore\Modules\CData\FD16xxV3\UnregisteredOnts
Expand Down Expand Up @@ -581,7 +581,7 @@ models:
ctrl_ont_descr: \SwitcherCore\Modules\CData\FD16xxV3\CtrlOntDescription
console_command: \SwitcherCore\Modules\CData\FD16xxV3\RawConsoleCommand
multi_console_command: \SwitcherCore\Modules\CData\FD16xxV3\MultiRawConsoleCommand
ctrl_port_descr: \SwitcherCore\Modules\CData\FD16xxV3\PortDescriptionControl
#ctrl_port_descr: \SwitcherCore\Modules\CData\FD16xxV3\PortDescriptionControl
ctrl_ont_delete: \SwitcherCore\Modules\CData\FD16xxV3\OntDeleteGpon
uni_interfaces_status: \SwitcherCore\Modules\CData\FD16xxV3\OntUniPortsStatus
unregistered_onts: \SwitcherCore\Modules\CData\FD16xxV3\UnregisteredOnts
Expand Down
15 changes: 2 additions & 13 deletions src/Modules/CData/FD16xxV3/PortDescriptionControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,9 @@ class PortDescriptionControl extends CDataAbstractModuleFD16xxV3

function setPortNameViaConsole($interface, $description)
{
if (strlen($description) > 16) {
throw new \InvalidArgumentException("Port name. <S><Length 1~16>.");
}
preg_match_all('!\d+!', $interface['name'], $matches);
$f_s = $matches[0][0] . '/' . $matches[0][1];
$port_numb = $matches[0][2];

if(!isset($interface['pontype'])){
preg_match_all('![a-z]!', $interface['name'], $letters);
$interface['pontype'] = implode('', $letters[0]);
}

$this->console->exec("interface {$interface['pontype']} {$f_s}");
$response = $this->console->exec("port-name {$port_numb} {$description}");
$this->console->exec("interface gpon 0/0");
$response = $this->console->exec("port-desc {$interface['_port']} description {$description}");

if (preg_match('/Command incomplete/', $response)) return false;
if (preg_match('/Unknown command/', $response)) return false;
Expand Down

0 comments on commit df4539a

Please sign in to comment.