|
@@ -57,9 +57,10 @@ EOT
|
|
$webservice = $this->getContainer()->get('webservice');
|
|
$webservice = $this->getContainer()->get('webservice');
|
|
// consulto si hay un DHCP Host para la mac y traigo el HostType
|
|
// consulto si hay un DHCP Host para la mac y traigo el HostType
|
|
$host = null;
|
|
$host = null;
|
|
- $hostJSON = $webservice->makeGetRequest($input->getOption('url-get'), HttpRequestInterface::METHOD_GET, [
|
|
|
|
|
|
+ $url = $webservice->buildUrl($input->getOption('url-get'), [
|
|
'mac' => $mac,
|
|
'mac' => $mac,
|
|
- ], $credentials);
|
|
|
|
|
|
+ ]);
|
|
|
|
+ $hostJSON = $webservice->makeGetRequest($url, HttpRequestInterface::METHOD_GET, [], $credentials);
|
|
if ($hostJSON != '') {
|
|
if ($hostJSON != '') {
|
|
$host = current(json_decode($hostJSON, true));
|
|
$host = current(json_decode($hostJSON, true));
|
|
}
|
|
}
|
|
@@ -68,9 +69,10 @@ EOT
|
|
if (isset($host['hostType'])) {
|
|
if (isset($host['hostType'])) {
|
|
$hostType = $host['hostType']['id'];
|
|
$hostType = $host['hostType']['id'];
|
|
} else {
|
|
} else {
|
|
- $hostTypeJSON = $webservice->makeGetRequest($this->getUrlParameterHostType(), HttpRequestInterface::METHOD_GET, [
|
|
|
|
|
|
+ $url = $webservice->buildUrl($this->getUrlParameterHostType(), [
|
|
'name' => 'Cablemodem',
|
|
'name' => 'Cablemodem',
|
|
- ], $credentials);
|
|
|
|
|
|
+ ]);
|
|
|
|
+ $hostTypeJSON = $webservice->makeGetRequest($url, HttpRequestInterface::METHOD_GET, [], $credentials);
|
|
if ($hostTypeJSON != '') {
|
|
if ($hostTypeJSON != '') {
|
|
$hostType = current(json_decode($hostTypeJSON, true))['id'];
|
|
$hostType = current(json_decode($hostTypeJSON, true))['id'];
|
|
}
|
|
}
|
|
@@ -83,11 +85,16 @@ EOT
|
|
$method = HttpRequestInterface::METHOD_PUT;
|
|
$method = HttpRequestInterface::METHOD_PUT;
|
|
}
|
|
}
|
|
|
|
|
|
- $result = $webservice->makeGetRequest($this->getUrlParameter($method, $host), $method, [
|
|
|
|
|
|
+ $data = [
|
|
'mac' => $mac,
|
|
'mac' => $mac,
|
|
- 'options' => $cablemodem->getDHCPOptions(),
|
|
|
|
'hostType' => $hostType,
|
|
'hostType' => $hostType,
|
|
- ], $credentials);
|
|
|
|
|
|
+ 'state' => 'active',
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ $dhcpOptions = $cablemodem->getDHCPOptions();
|
|
|
|
+ $data = array_merge($data, $dhcpOptions);
|
|
|
|
+
|
|
|
|
+ $result = $webservice->makeGetRequest($this->getUrlParameter($method, $host), $method, $data, $credentials);
|
|
|
|
|
|
$output->writeln($result);
|
|
$output->writeln($result);
|
|
} else {
|
|
} else {
|