Преглед на файлове

FD3-504 se crea el host con las opciones dhcp al crear un cablemodem

Guillermo Espinoza преди 7 години
родител
ревизия
6d12943e5f
променени са 2 файла, в които са добавени 12 реда и са изтрити 5 реда
  1. 7 3
      src/CablemodemBundle/Command/DHCPHostCRUDCommand.php
  2. 5 2
      src/CablemodemBundle/Entity/Cablemodem.php

+ 7 - 3
src/CablemodemBundle/Command/DHCPHostCRUDCommand.php

@@ -83,11 +83,15 @@ EOT
                 $method = HttpRequestInterface::METHOD_PUT;
             }
 
-            $result = $webservice->makeGetRequest($this->getUrlParameter($method, $host), $method, [
+            $data = [
                 'mac' => $mac,
-                'options' => $cablemodem->getDHCPOptions(),
                 'hostType' => $hostType,
-            ], $credentials);
+            ];
+
+            $dhcpOptions = $cablemodem->getDHCPOptions();
+            $data = array_merge($data, $dhcpOptions);
+
+            $result = $webservice->makeGetRequest($this->getUrlParameter($method, $host), $method, $data, $credentials);
 
             $output->writeln($result);
         } else {

+ 5 - 2
src/CablemodemBundle/Entity/Cablemodem.php

@@ -373,9 +373,12 @@ class Cablemodem implements DeviceInterface, TenancyIdTraitInterface, LocationIn
     */
    public function getDHCPOptions()
    {
-       $options = "";
+       $options = [
+           'filename' => $this->mac . '.bin',
+       ];
        if ($this->mtaEnabled) {
-           $options .= "option option122.dhcp-server 255.255.255.255;\r\noption option122.provisioning-type \"BASIC.1\";\r\n";
+           $options['option122_dhcp_server'] = "255.255.255.255";
+           $options['option122_provisioning_type'] = "BASIC.1";
        }
 
        return $options;