From 9d670d3e094fb2b723bab64af3f627e60b7ffae1 Mon Sep 17 00:00:00 2001 From: Baohua Yang Date: Wed, 20 Nov 2013 19:55:14 +0800 Subject: [PATCH] Rewrite test cases for arp handler, container manager and forwarding manager, to let them support CONTROLLER argument Change-Id: If3be93f2515ca3a65d599f1463947293bbea4648 Signed-off-by: Baohua Yang --- .../Robot_Tool/suites/base/arp_handler.txt | 38 ++++++++++++------ .../suites/base/container_manager.txt | 39 +++++++++++++------ .../suites/base/forwarding_manager.txt | 39 +++++++++++++------ 3 files changed, 80 insertions(+), 36 deletions(-) diff --git a/test/tools/Robot_Tool/suites/base/arp_handler.txt b/test/tools/Robot_Tool/suites/base/arp_handler.txt index 87a43662de..b1d7dd0c72 100644 --- a/test/tools/Robot_Tool/suites/base/arp_handler.txt +++ b/test/tools/Robot_Tool/suites/base/arp_handler.txt @@ -1,27 +1,41 @@ *** Settings *** Documentation Test suite for the arp handler bundle. +Suite Teardown Delete All Sessions Library Collections -Library RequestsLibrary +Library ../../libraries/RequestsLibrary.py Library ../../libraries/Common.py -Library ../../libraries/ArpHandler.py Variables ../../variables/Variables.py *** Variables *** -${name} test_subnet1 +${name} test ${key} subnetConfig +${REST_CONTEXT} /controller/nb/v2/subnetservice *** Test Cases *** -Add and remove a subnet - [Documentation] Add and remove a subnet. After each operation, list to validate the result. - [Tags] add_remove_info +Add a subnet + [Documentation] Add a subnet, list to validate the result. + [Tags] add ${body} Create Dictionary name ${name} subnet 10.0.0.254/8 - Add Subnet Gateway ${name} ${body} - ${result} Get Subnets - Dictionary Should Contain Key ${result} ${key} + ${headers} Create Dictionary Content-Type application/json + Create Session session http://${CONTROLLER}:8080 headers=${headers} auth=${auth} + ${resp} Put session ${REST_CONTEXT}/${CONTAINER}/subnet/${name} data=${body} + Should Be Equal As Strings ${resp.status_code} 201 Response status code error + ${resp} Get session ${REST_CONTEXT}/${CONTAINER}/subnets + Should Be Equal As Strings ${resp.status_code} 200 Response status code error + ${result} To JSON ${resp.content} ${content} Get From Dictionary ${result} ${key} List Should Contain Value ${content} ${body} - Remove Subnet Gateway ${name} - ${result} Get Subnets - Dictionary Should Contain Key ${result} ${key} + +Remove a subnet + [Documentation] Remove a subnet, list to validate the result. + [Tags] remove + ${body} Create Dictionary name ${name} subnet 10.0.0.254/8 + ${headers} Create Dictionary Content-Type application/json + Create Session session http://${CONTROLLER}:8080 headers=${headers} auth=${auth} + ${resp} Delete session ${REST_CONTEXT}/${CONTAINER}/subnet/${name} + Should Be Equal As Strings ${resp.status_code} 204 Response status code error + ${resp} Get session ${REST_CONTEXT}/${CONTAINER}/subnets + Should Be Equal As Strings ${resp.status_code} 200 Response status code error + ${result} To JSON ${resp.content} ${content} Get From Dictionary ${result} ${key} List Should Not Contain Value ${content} ${body} diff --git a/test/tools/Robot_Tool/suites/base/container_manager.txt b/test/tools/Robot_Tool/suites/base/container_manager.txt index 8cd485df16..af738a1d27 100644 --- a/test/tools/Robot_Tool/suites/base/container_manager.txt +++ b/test/tools/Robot_Tool/suites/base/container_manager.txt @@ -1,31 +1,46 @@ *** Settings *** Documentation Test suite for the container manager bundle. +Suite Teardown Delete All Sessions Library Collections -Library RequestsLibrary +Library ../../libraries/RequestsLibrary.py Library ../../libraries/Common.py -Library ../../libraries/ContainerManager.py Variables ../../variables/Variables.py *** Variables *** ${name} test_container1 @{nodeconnectors} OF|1@OF|00:00:00:00:00:00:00:01 OF|23@OF|00:00:00:00:00:00:20:21 ${key} container-config +${REST_CONTEXT} /controller/nb/v2/containermanager *** Test Cases *** -Add and remove a container - [Documentation] Add and remove a container. After each operation, list to validate the result. - [Tags] add_remove_info +Add a container + [Documentation] Add a container, list to validate the result. + [Tags] add ${flowspecs} Convert To List ${EMPTY} - Log Variables ${body} Create Dictionary container ${name} flowSpecs ${flowspecs} staticVlan ... 10 nodeConnectors ${nodeconnectors} - Add Container ${name} ${body} - ${result} Get Containers - Dictionary Should Contain Key ${result} ${key} + ${headers} Create Dictionary Content-Type application/json + Create Session session http://${CONTROLLER}:8080 headers=${headers} auth=${auth} + ${resp} Put session ${REST_CONTEXT}/container/${name} data=${body} + Should Be Equal As Strings ${resp.status_code} 201 Response status code error + ${resp} Get session ${REST_CONTEXT}/containers + Should Be Equal As Strings ${resp.status_code} 200 Response status code error + ${result} To JSON ${resp.content} ${content} Get From Dictionary ${result} ${key} List Should Contain Value ${content} ${body} - Remove Container ${name} - ${result} Get Containers - Dictionary Should Contain Key ${result} ${key} + +Remove a container + [Documentation] Remove a container, list to validate the result. + [Tags] remove + ${flowspecs} Convert To List ${EMPTY} + ${body} Create Dictionary container ${name} flowSpecs ${flowspecs} staticVlan + ... 10 nodeConnectors ${nodeconnectors} + ${headers} Create Dictionary Content-Type application/json + Create Session session http://${CONTROLLER}:8080 headers=${headers} auth=${auth} + ${resp} Delete session ${REST_CONTEXT}/container/${name} + Should Be Equal As Strings ${resp.status_code} 204 Response status code error + ${resp} Get session ${REST_CONTEXT}/containers + Should Be Equal As Strings ${resp.status_code} 200 Response status code error + ${result} To JSON ${resp.content} ${content} Get From Dictionary ${result} ${key} List Should Not Contain Value ${content} ${body} diff --git a/test/tools/Robot_Tool/suites/base/forwarding_manager.txt b/test/tools/Robot_Tool/suites/base/forwarding_manager.txt index 070473bfff..00ccf54624 100644 --- a/test/tools/Robot_Tool/suites/base/forwarding_manager.txt +++ b/test/tools/Robot_Tool/suites/base/forwarding_manager.txt @@ -1,28 +1,43 @@ *** Settings *** -Documentation Test suite for the arp handler bundle. +Documentation Test suite for the forwarding manager bundle. +Suite Teardown Delete All Sessions Library Collections -Library RequestsLibrary +Library ../../libraries/RequestsLibrary.py Library ../../libraries/Common.py -Library ../../libraries/ForwardingManager.py Variables ../../variables/Variables.py *** Variables *** ${name} test_route1 ${key} staticRoute +${REST_CONTEXT} /controller/nb/v2/staticroute *** Test Cases *** -Add and remove a static route - [Documentation] Add and remove a static route. After each operation, list to validate the result. - [Tags] add_remove_info +Add a static route + [Documentation] Add a static route, list to validate the result. + [Tags] add ${body} Create Dictionary name ${name} prefix 192.168.1.0/24 nextHop ... 10.0.0.2 - Add Static Route ${name} ${body} - ${result} Get Routes - Dictionary Should Contain Key ${result} ${key} + ${headers} Create Dictionary Content-Type application/json + Create Session session http://${CONTROLLER}:8080 headers=${headers} auth=${auth} + ${resp} Put session ${REST_CONTEXT}/${CONTAINER}/route/${name} data=${body} + Should Be Equal As Strings ${resp.status_code} 201 Response status code error + ${resp} Get session ${REST_CONTEXT}/${CONTAINER}/routes + Should Be Equal As Strings ${resp.status_code} 200 Response status code error + ${result} To JSON ${resp.content} ${content} Get From Dictionary ${result} ${key} List Should Contain Value ${content} ${body} - Remove Static Route ${name} - ${result} Get Routes - Dictionary Should Contain Key ${result} ${key} + +Remove a subnet + [Documentation] Remove a subnet, list to validate the result. + [Tags] remove + ${body} Create Dictionary name ${name} prefix 192.168.1.0/24 nextHop + ... 10.0.0.2 + ${headers} Create Dictionary Content-Type application/json + Create Session session http://${CONTROLLER}:8080 headers=${headers} auth=${auth} + ${resp} Delete session ${REST_CONTEXT}/${CONTAINER}/route/${name} + Should Be Equal As Strings ${resp.status_code} 204 Response status code error + ${resp} Get session ${REST_CONTEXT}/${CONTAINER}/routes + Should Be Equal As Strings ${resp.status_code} 200 Response status code error + ${result} To JSON ${resp.content} ${content} Get From Dictionary ${result} ${key} List Should Not Contain Value ${content} ${body} -- 2.36.6