Let test cases support controller argument, inclduding forwarding rule manager, host...
[integration/test.git] / test / tools / Robot_Tool / suites / base / forwarding_rule_manager.txt
index 116b39c50d9afe853a3029f81693a9d63622bcd8..88c2fa5eb7d2e967aae51517696e428b2c447b4d 100644 (file)
@@ -1,33 +1,50 @@
 *** Settings ***
-Documentation     Test suite for the arp handler bundle.
+Documentation     Test suite for the forwarding rule manager module.
+Suite Teardown    Delete All Sessions
 Library           Collections
-Library           RequestsLibrary
+Library           ../../libraries/RequestsLibrary.py
 Library           ../../libraries/Common.py
-Library           ../../libraries/ForwardingRuleManager.py
 Variables         ../../variables/Variables.py
 
 *** Variables ***
 ${name}           flow1
 ${key}            flowConfig
 ${node_id}        00:00:00:00:00:00:00:02
+${REST_CONTEXT}    /controller/nb/v2/flowprogrammer
 
 *** Test Cases ***
-Add and remove a flow
-    [Documentation]    Add and remove a flow. After each operation, list to validate the result.
-    [Tags]    add_remove_info
-    ${node }    Create Dictionary    type    OF    id    ${node_id}
+Add a flow
+    [Documentation]    Add a flow, list to validate the result.
+    [Tags]    add
+    ${node}    Create Dictionary    type    OF    id    ${node_id}
     ${actions}    Create List    OUTPUT=1
     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
     ...    ${node}    priority    1    etherType    0x800    nwDst
     ...    10.0.0.1/32    actions    ${actions}
-    Add Flow To Node    OF    ${node_id}    ${name}    ${body}
-    Log Variables
-    ${result}    Get Flows
-    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}/node/OF/${node_id}/staticFlow/${name}    data=${body}
+    Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    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 Flow From Node    OF    ${node_id}    ${name}
-    ${result}    Get Flows
-    Dictionary Should Contain Key    ${result}    ${key}
+
+Remove a flow
+    [Documentation]    Remove a flow, list to validate the result.
+    [Tags]    remove
+    ${node}    Create Dictionary    type    OF    id    ${node_id}
+    ${actions}    Create List    OUTPUT=1
+    ${body}    Create Dictionary    name    ${name}    installInHw    true    node
+    ...    ${node}    priority    1    etherType    0x800    nwDst
+    ...    10.0.0.1/32    actions    ${actions}
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
+    ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}
+    Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    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}