Rewrite test cases for arp handler, container manager and forwarding manager, to...
[integration/test.git] / test / tools / Robot_Tool / suites / base / arp_handler.txt
index 87a43662ded30789276864992ee212c94223be9e..b1d7dd0c72f445819da83972493e1c6fe345e9bf 100644 (file)
@@ -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}