Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 340e372a authored by Frederico SEQUEIRA's avatar Frederico SEQUEIRA
Browse files

:white_check_mark: Add Robot testing to Mac Address

parent 8f48d229
No related branches found
No related tags found
5 merge requests!133Draft: Rebase v4 firewall,!131Draft: Rebase v4.1,!129Draft: Rebase v4,!126Develop,!124✅ Add Robot testing to Mac Address
*** Settings ***
Test Tags Docs
Library RequestsLibrary
Library OperatingSystem
Library Collections
*** Variables ***
${HOST} 172.19.0.5
${PORT} 8080
${BASE_URL} http://${HOST}:${PORT}
${MAC_ENDPOINT} /api/plugins/mac-address/macaddress/
${VLAN_ENDPOINT} /api/ipam/vlans/
${VLANGROUP_ENDPOINT} /api/ipam/vlan-groups/
${B_TOKEN} Token only4testingpurpose
*** Test Cases ***
Create VLAN for testing
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${payload} Create Dictionary name robottest_vlan vid 2
${response}= POST ${BASE_URL}${VLAN_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
${json} Set Variable ${response.json()}
Convert to Dictionary ${json}
${VLAN_ID} Get From Dictionary ${json} id
Set Global Variable ${VLAN_ID}
Create VLAN Group for testing
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${payload} Create Dictionary name robottest_vlan_group slug slug_test
${response}= POST ${BASE_URL}${VLANGROUP_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
${json} Set Variable ${response.json()}
Convert to Dictionary ${json}
${VLANGROUP_ID}= Get From Dictionary ${json} id
Set Global Variable ${VLANGROUP_ID}
Create Mac address assigned to VLAN
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:91:EF status active end_date 2024-10-30 description robot_testing assigned_object_id ${VLAN_ID} assigned_object_type vlan
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
${json} Set Variable ${response.json()}
Convert to Dictionary ${json}
${MACADDRESS_ID}= Get From Dictionary ${json} id
Set Global Variable ${MACADDRESS_ID}
Create Test Unique Mac address constraint
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:91:EF status active end_date 2024-10-30 description robot_testing_vlan assigned_object_id 1 assigned_object_type vlan
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=400
Create Mac address assigned to VLAN Group
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:92:EF status active end_date 2024-10-30 description robot_testing_vlan_group assigned_object_id ${VLANGROUP_ID} assigned_object_type vlangroup
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
Create Mac address assigned to wrong Object
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:93:EF status active end_date 2024-10-30 description robot_testing_vlan_group assigned_object_id 1 assigned_object_type wrong_obj
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=400
Create Test Delete Mac Address assigned to VLAN
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${response}= DELETE ${BASE_URL}${MAC_ENDPOINT}${MACADDRESS_ID} headers=${HEADERS} expected_status=204
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment