|
@@ -71,20 +71,20 @@ EOT
|
|
|
$cpeFixedIP = $this->cablemodem->getCpeFixedIP();
|
|
|
if ($cpeFixedIP) {
|
|
|
$this->io->section('Creating DHCP CPE Host');
|
|
|
- $this->io->success('RESULT: ' . $this->createHost('CPE'));
|
|
|
+ $this->io->success('RESULT: ' . $this->createHost('cpe'));
|
|
|
} else {
|
|
|
$this->io->section('Deleting DHCP CPE Host');
|
|
|
- $this->io->success('RESULT: ' . $this->deleteHost('CPE'));
|
|
|
+ $this->io->success('RESULT: ' . $this->deleteHost('cpe'));
|
|
|
}
|
|
|
|
|
|
// Crea o elimina si existe el Host MTA
|
|
|
$mtaFixedIP = $this->cablemodem->getMtaFixedIP();
|
|
|
if ($mtaFixedIP) {
|
|
|
$this->io->section('Creating DHCP MTA Host');
|
|
|
- $this->io->success('RESULT: ' . $this->createHost('MTA'));
|
|
|
+ $this->io->success('RESULT: ' . $this->createHost('mta'));
|
|
|
} else {
|
|
|
$this->io->section('Deleting DHCP MTA Host');
|
|
|
- $this->io->success('RESULT: ' . $this->deleteHost('MTA'));
|
|
|
+ $this->io->success('RESULT: ' . $this->deleteHost('mta'));
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -97,7 +97,7 @@ EOT
|
|
|
*
|
|
|
* @return string
|
|
|
*/
|
|
|
- private function createHost($type = 'Cablemodem')
|
|
|
+ private function createHost($type = 'cablemodem')
|
|
|
{
|
|
|
$ws = $this->webservice;
|
|
|
$urlGET = $this->input->getOption('url-get');
|
|
@@ -112,7 +112,7 @@ EOT
|
|
|
}
|
|
|
|
|
|
// Consulto por Host con HostType MTA o CPE relacionado
|
|
|
- if ($host && ($type == 'MTA' || $type == 'CPE')) {
|
|
|
+ if ($host && ($type == 'mta' || $type == 'cpe')) {
|
|
|
$hostId = $host['id'];
|
|
|
$url = $ws->buildUrl($urlGET, [
|
|
|
'host' => $hostId,
|
|
@@ -123,6 +123,10 @@ EOT
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (!isset($hostId)) {
|
|
|
+ $this->io->error("No existe el hostType {$type} en DHCP");
|
|
|
+ }
|
|
|
+
|
|
|
// Creo, edito o elimino dependiendo los parámetros
|
|
|
$method = HttpRequestInterface::METHOD_POST;
|
|
|
if ($this->input->getOption('delete') == true) {
|
|
@@ -145,15 +149,15 @@ EOT
|
|
|
'fixed_address' => $fixedIP ?: null,
|
|
|
'fixedIP' => $fixedIP ? true : false,
|
|
|
];
|
|
|
- if ($type == 'MTA' || $type == 'CPE') {
|
|
|
+ if ($type == 'mta' || $type == 'cpe') {
|
|
|
unset($data['mac']);
|
|
|
$data['host'] = $hostId;
|
|
|
|
|
|
- if ($type == 'MTA') {
|
|
|
+ if ($type == 'mta') {
|
|
|
$data['fixed_address'] = $mtaFixedIP ?: null;
|
|
|
$data['fixedIP'] = $mtaFixedIP ? true : false;
|
|
|
}
|
|
|
- if ($type == 'CPE') {
|
|
|
+ if ($type == 'cpe') {
|
|
|
$data['fixed_address'] = $cpeFixedIP ?: null;
|
|
|
$data['fixedIP'] = $cpeFixedIP ? true : false;
|
|
|
}
|
|
@@ -171,7 +175,7 @@ EOT
|
|
|
*
|
|
|
* @return string
|
|
|
*/
|
|
|
- private function deleteHost($type = 'Cablemodem')
|
|
|
+ private function deleteHost($type = 'cablemodem')
|
|
|
{
|
|
|
$ws = $this->webservice;
|
|
|
$urlGET = $this->input->getOption('url-get');
|
|
@@ -187,7 +191,7 @@ EOT
|
|
|
|
|
|
// Consulto por Host con HostType MTA o CPE relacionado
|
|
|
$deleteHost = null;
|
|
|
- if ($host && ($type == 'MTA' || $type == 'CPE')) {
|
|
|
+ if ($host && ($type == 'mta' || $type == 'cpe')) {
|
|
|
$hostId = $host['id'];
|
|
|
$url = $ws->buildUrl($urlGET, [
|
|
|
'host' => $hostId,
|
|
@@ -247,7 +251,7 @@ EOT
|
|
|
*
|
|
|
* @return int
|
|
|
*/
|
|
|
- private function getIdHostType($name = 'Cablemodem')
|
|
|
+ private function getIdHostType($name = 'cablemodem')
|
|
|
{
|
|
|
$hostType = null;
|
|
|
$container = $this->getContainer();
|