refs #1567. New subnet field: 'dns'
testing/ogcore-api/pipeline/head This commit looks good Details

pull/21/head
Manuel Aranda Rosales 2025-02-28 09:12:44 +01:00
parent b3b3bf892d
commit 6b26b78995
7 changed files with 63 additions and 3 deletions

View File

@ -1,11 +1,15 @@
# Changelog
## [0.8.2] - 2025-03-04
### 🔹 Added
- Nueva funcionalidad para tener notificaciones en tiempo real. Instalación de bundle "Mercure".
- Nueva funcionalidad para tener notificaciones en tiempo real. Instalación de bundle "Mercure".
- Creacion de EventListener en Symfony, para publicar mensajes en Mercure, cuando se realicen cambios en la base de datos ( cambio de estado en lo equipos, y trazas).
- Nuevo endpoint "backup image". Integracion con ogRepository.
- Nuevo campo en "usuarios" el cual permite escoger la visualizacion por defecto de la vista "grupos".
- Nuevo campo "dns" en "subredes" para gestionar los servidores DNS.
### ⚡ Changed
- Cambios en logs. Cambios en salida (stderror -> file.log)
- Modulo DHCP. Añadir equipos, ahora se gestiona con una unica llamada a la API.
---
## [0.8.1] - 2025-02-25
@ -23,7 +27,6 @@
- Limpieza en campos "name" y "date" de ogLive. Es necesario parsear el campo "filename" para facilitar el uso al usuario en la web.
### 🐛 Fixed
- Corrección de bug que impedia borrar un cliente si tenia una traza enlazada.
-
---

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250227154452 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE subnet ADD dns VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE subnet DROP dns');
}
}

View File

@ -33,6 +33,7 @@ class PostAction extends AbstractOgDhcpController
'nextServer' => $data->getNextServer(),
'bootFileName' => $data->getBootFileName(),
'router' => $data->getRouter(),
'DNS' => $data->getDns()
]
];

View File

@ -63,7 +63,7 @@ class SyncAction extends AbstractOgDhcpController
{
$getParsedData = $this->getIpAddressAndNetmaskFromCIDRService->__invoke($subnet['subnet']);
$subnetEntity->setName($subnet['id'].' - '.$subnet['subnet']);
$subnetEntity->setName('Subred -'.$subnet['id']);
$subnetEntity->setBootFileName($subnet['boot-file-name'] ?? null);
$subnetEntity->setIpAddress($getParsedData['ip']);
$subnetEntity->setNetmask($getParsedData['mask']);

View File

@ -36,6 +36,10 @@ final class SubnetInput
#[ApiProperty(description: 'The router of the subnet', example: "")]
public ?string $router = null;
#[Groups(['subnet:write'])]
#[ApiProperty(description: 'The dns server of the subnet', example: "")]
public ?string $dns = null;
#[Groups(['subnet:write'])]
#[ApiProperty(description: 'The boot file name of the subnet', example: "")]
public ?string $bootFileName = null;
@ -58,6 +62,7 @@ final class SubnetInput
$this->ipAddress = $subnet->getIpAddress();
$this->router = $subnet->getRouter();
$this->nextServer = $subnet->getNextServer();
$this->dns = $subnet->getDns();
$this->bootFileName = $subnet->getBootFileName();
if ($subnet->getOrganizationalUnits()) {
@ -76,6 +81,7 @@ final class SubnetInput
$subnet->setName($this->name);
$subnet->setNetmask($this->netmask);
$subnet->setIpAddress($this->ipAddress);
$subnet->setDns($this->dns);
$subnet->setNextServer($this->nextServer);
$subnet->setBootFileName($this->bootFileName);
$subnet->setRouter($this->router);

View File

@ -30,6 +30,9 @@ final class SubnetOutput extends AbstractOutput
#[Groups(['subnet:read'])]
public ?string $router = null;
#[Groups(['subnet:read'])]
public ?string $dns = null;
#[Groups(['subnet:read'])]
public array $clients;
@ -54,6 +57,7 @@ final class SubnetOutput extends AbstractOutput
$this->ipAddress = $subnet->getIpAddress();
$this->nextServer = $subnet->getNextServer();
$this->router = $subnet->getRouter();
$this->dns = $subnet->getDns();
$this->bootFileName = $subnet->getBootFileName();
$this->synchronized = $subnet->isSynchronized();
$this->serverId = $subnet->getServerId();

View File

@ -43,6 +43,9 @@ class Subnet extends AbstractEntity
#[ORM\Column(length: 255, nullable: true)]
private ?string $router = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $dns = null;
public function __construct()
{
parent::__construct();
@ -202,4 +205,16 @@ class Subnet extends AbstractEntity
return $this;
}
public function getDns(): ?string
{
return $this->dns;
}
public function setDns(?string $dns): static
{
$this->dns = $dns;
return $this;
}
}