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 title: OgDHCP API
description: OgDHCP API documentation description: OgDHCP API documentation
version: 1.0.0 version: 1.0.0
components: components:
schemas: schemas:
Subnet: Host:
type: object type: object
properties: properties:
id: hostname:
type: integer type: string
description: The ID of the subnet description: The hostname of the device
subnet: example: "pc11"
type: string hw-address:
description: The name of the subnet type: string
nextServer: description: The hardware address (MAC)
type: string example: "56:6f:c7:4f:00:4f"
description: The next server in the subnet ip-address:
bootFileName: type: string
type: string description: The IP address assigned to the host
description: The boot file name for the subnet example: "192.168.5.11"
reservations: Subnet:
type: array type: object
items: properties:
type: object id:
description: The reservations in the subnet 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 areas: # to filter documented areas
path_patterns: path_patterns:

View File

@ -306,13 +306,7 @@ public function getSubnets(): JsonResponse
* @OA\JsonContent( * @OA\JsonContent(
* type="object", * type="object",
* @OA\Property(property="success", type="string", example="Subnet added successfully"), * @OA\Property(property="success", type="string", example="Subnet added successfully"),
* @OA\Property(property="message", type="object", * @OA\Property(property="message", ref="#/components/schemas/Subnet")
* @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\Response( * @OA\Response(

View File

@ -20,7 +20,7 @@ ${subnet_error} 0
Get Status of the DHCP server Get Status of the DHCP server
[Documentation] Get status of the dhcp server and check services status [Documentation] Get status of the dhcp server and check services status
[Tags] status [Tags] status
${response}= GET ${BASE_URL}/status ${response}= GET ${BASE_URL}/status
Status Should Be 200 ${response} Status Should Be 200 ${response}
Log ${response.json()} Log ${response.json()}
# Convertir la respuesta a JSON usando ${response.json()} # Convertir la respuesta a JSON usando ${response.json()}
@ -64,7 +64,7 @@ Post a new subnet
... nextServer=192.168.2.1 ... nextServer=192.168.2.1
... bootFileName=pxelinux.0 ... bootFileName=pxelinux.0
${headers}= Create Dictionary Content-Type=application/json ${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} Status Should Be 200 ${response}
${json}= Convert to Dictionary ${response.json()} ${json}= Convert to Dictionary ${response.json()}
Dictionary Should Contain Key ${json} success Dictionary Should Contain Key ${json} success
@ -87,7 +87,7 @@ Post a new subnet with existing id
Status Should Be 400 ${response} Status Should Be 400 ${response}
${json}= Convert to Dictionary ${response.json()} ${json}= Convert to Dictionary ${response.json()}
Dictionary Should Contain Key ${json} error 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 Post a new subnet with existing address
[Documentation] Post a new subnet with invalid data [Documentation] Post a new subnet with invalid data
@ -104,7 +104,7 @@ Post a new subnet with existing address
Status Should Be 400 ${response} Status Should Be 400 ${response}
${json}= Convert to Dictionary ${response.json()} ${json}= Convert to Dictionary ${response.json()}
Dictionary Should Contain Key ${json} error 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 Modify an existing subnet by id
@ -169,7 +169,7 @@ Modify subnet with invalid configuration address without netmask
${json}= Convert To Dictionary ${response.json()} ${json}= Convert To Dictionary ${response.json()}
# Verificar que la respuesta contiene el error esperado # 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 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. [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()} ${json}= Convert To Dictionary ${response.json()}
# Verificar que la respuesta contiene el error esperado # 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 Delete subnet by id
[Documentation] Este test verifica que la subred se elimina correctamente con el código 200. [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' # Verificar que la respuesta contiene la clave 'error'
Dictionary Should Contain Key ${json} error Dictionary Should Contain Key ${json} error
# Validar el mensaje de 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