refs #812 Adds host schema, adds subnet call to the subnet schema, deletes some output error in API Robot
testing/og-dhcp-API/pipeline/head There was a failure building this commit Details

nginx_conf
Luis Gerardo Romero Garcia 2024-10-08 18:05:41 +02:00
parent db9ce9c90e
commit 72d5240932
3 changed files with 46 additions and 36 deletions

View File

@ -4,28 +4,44 @@ nelmio_api_doc:
title: OgDHCP API
description: OgDHCP API documentation
version: 1.0.0
components:
schemas:
Subnet:
type: object
properties:
id:
type: integer
description: The ID of the subnet
subnet:
type: string
description: The name of the subnet
nextServer:
type: string
description: The next server in the subnet
bootFileName:
type: string
description: The boot file name for the subnet
reservations:
type: array
items:
type: object
description: The reservations in the subnet
components:
schemas:
Host:
type: object
properties:
hostname:
type: string
description: The hostname of the device
example: "pc11"
hw-address:
type: string
description: The hardware address (MAC)
example: "56:6f:c7:4f:00:4f"
ip-address:
type: string
description: The IP address assigned to the host
example: "192.168.5.11"
Subnet:
type: object
properties:
id:
type: integer
description: The ID of the subnet
subnet:
type: string
description: The name of the subnet
next-server:
type: string
description: The next server in the subnet
boot-file-name:
type: string
description: The boot file name for the subnet
reservations:
type: array
items:
$ref: '#/components/schemas/Host'
description: The reservations in the subnet
areas: # to filter documented areas
path_patterns:

View File

@ -306,13 +306,7 @@ public function getSubnets(): JsonResponse
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="string", example="Subnet added successfully"),
* @OA\Property(property="message", type="object",
* @OA\Property(property="subnetId", type="integer", example=2),
* @OA\Property(property="subnet", type="string", example="192.168.1.0/24"),
* @OA\Property(property="nextServer", type="string", example="192.168.1.1"),
* @OA\Property(property="bootFileName", type="string", example="pxelinux.0"),
* @OA\Property(property="reservations", type="array", @OA\Items(type="object"))
* )
* @OA\Property(property="message", ref="#/components/schemas/Subnet")
* )
* ),
* @OA\Response(

View File

@ -20,7 +20,7 @@ ${subnet_error} 0
Get Status of the DHCP server
[Documentation] Get status of the dhcp server and check services status
[Tags] status
${response}= GET ${BASE_URL}/status
${response}= GET ${BASE_URL}/status
Status Should Be 200 ${response}
Log ${response.json()}
# Convertir la respuesta a JSON usando ${response.json()}
@ -64,7 +64,7 @@ Post a new subnet
... nextServer=192.168.2.1
... bootFileName=pxelinux.0
${headers}= Create Dictionary Content-Type=application/json
${response}= POST ${BASE_URL}/subnets json=${new_subnet} headers=${headers} expected_status=200
${response}= POST ${BASE_URL}/subnets json=${new_subnet} headers=${headers}
Status Should Be 200 ${response}
${json}= Convert to Dictionary ${response.json()}
Dictionary Should Contain Key ${json} success
@ -87,7 +87,7 @@ Post a new subnet with existing id
Status Should Be 400 ${response}
${json}= Convert to Dictionary ${response.json()}
Dictionary Should Contain Key ${json} error
Should Contain ${response.json()["error"]} Error: La subred con el id '${valid_net_id}' ya existe.
Should Contain ${response.json()["error"]} La subred con el id '${valid_net_id}' ya existe.
Post a new subnet with existing address
[Documentation] Post a new subnet with invalid data
@ -104,7 +104,7 @@ Post a new subnet with existing address
Status Should Be 400 ${response}
${json}= Convert to Dictionary ${response.json()}
Dictionary Should Contain Key ${json} error
Should Contain ${response.json()['error']} Error: La subred con la dirección '192.168.1.0/24' ya existe
Should Contain ${response.json()['error']} La subred con la dirección '192.168.1.0/24' ya existe
Modify an existing subnet by id
@ -169,7 +169,7 @@ Modify subnet with invalid configuration address without netmask
${json}= Convert To Dictionary ${response.json()}
# Verificar que la respuesta contiene el error esperado
Should Be Equal ${json['error']} Error: La máscara de red es requerida con el parametro 'address'
Should Be Equal ${json['error']} La máscara de red es requerida con el parametro 'address'
Modify subnet with invalid configuration netmask without addres
[Documentation] Este test verifica que la modificación falla cuando hay un error en la configuración de Kea DHCP.
@ -185,7 +185,7 @@ Modify subnet with invalid configuration netmask without addres
${json}= Convert To Dictionary ${response.json()}
# Verificar que la respuesta contiene el error esperado
Should Be Equal ${json['error']} Error: La dirección de red es requerida con el parametro 'mask'
Should Be Equal ${json['error']} La dirección de red es requerida con el parametro 'mask'
Delete subnet by id
[Documentation] Este test verifica que la subred se elimina correctamente con el código 200.
@ -209,7 +209,7 @@ Delete subnet - Error: wrong subnet Id
# Verificar que la respuesta contiene la clave 'error'
Dictionary Should Contain Key ${json} error
# Validar el mensaje de error
Should Be Equal ${json['error']} Error: La subred con el id '999' no existe
Should Be Equal ${json['error']} La subred con el id '999' no existe