large rework to optimize test code.
[integration/test.git] / test / csit / suites / karaf-compatible / 010__MD_SAL_NSF / 040__restconf_frm.txt
index a4d4cfd839c6a12ca27607d962e5561224adce80..1e8ce38242c58c798300d49d0a6cc8b8390802bb 100644 (file)
@@ -1,60 +1,54 @@
 *** Settings ***
 Documentation     Test suite for RESTCONF FRM
-Suite Setup       Create Session   session   http://${CONTROLLER}:${RESTCONFPORT}   auth=${AUTH}   headers=${HEADERS_XML}
+Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
 Suite Teardown    Delete All Sessions
 Library           Collections
 Library           ../../../libraries/RequestsLibrary.py
 Library           ../../../libraries/Common.py
 Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.txt
 
 *** Variables ***
+${REST_CON}       /restconf/config/opendaylight-inventory:nodes
+${REST_OPR}       /restconf/operational/opendaylight-inventory:nodes
+${BODY2}          <flow xmlns="urn:opendaylight:flow:inventory"><priority>2</priority><flow-name>Foo</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.20.1/32</ipv4-destination></match><id>152</id><table_id>0</table_id><instructions><instruction><order>0</order><apply-actions><action><order>0</order><output-action><output-node-connector>openflow:1:1</output-node-connector></output-action></action></apply-actions></instruction></instructions></flow>
 
-${REST_CON}        /restconf/config/opendaylight-inventory:nodes
-${REST_OPR}        /restconf/operational/opendaylight-inventory:nodes
-${BODY2}                  <flow xmlns="urn:opendaylight:flow:inventory"><priority>2</priority><flow-name>Foo</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.20.1/32</ipv4-destination></match><id>152</id><table_id>0</table_id><instructions><instruction><order>0</order><apply-actions><action><order>0</order><output-action><output-node-connector>openflow:1:1</output-node-connector></output-action></action></apply-actions></instruction></instructions></flow>
-
-*** Test Cases *** 
+*** Test Cases ***
 Add a flow - Output to physical port#
     [Documentation]    Push a flow through REST-API
-    [Tags]   Push
-    ${resp}   Putxml    session   ${REST_CON}/node/openflow:1/table/0/flow/152    data=${BODY2}
+    [Tags]    Push
+    ${resp}    Putxml    session    ${REST_CON}/node/openflow:1/table/0/flow/152    data=${BODY2}
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Verify after adding flow config - Output to physical port#
     [Documentation]    Verify the flow
-    [Tags]   Get
-    ${resp}    Get    session     ${REST_CON}/node/openflow:1/table/0
-    Should Be Equal As Strings    ${resp.status_code}    200  
-    Should Contain     ${resp.content}    152
+    [Tags]    Get
+    ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/0
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    152
+
 Verify after adding flow operational - Output to physical port#
     [Documentation]    Verify the flow
-    [Tags]   Get
-    Sleep    30
-    ${resp}    Get    session     ${REST_OPR}/node/openflow:1/table/0
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain     ${resp.content}    10.0.20.1
+    [Tags]    Get
+    ${elements}=    Create List    10.0.20.1
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_OPR}/node/openflow:1/table/0    ${elements}
 
 Remove a flow - Output to physical port#
     [Documentation]    Remove a flow
     [Tags]    remove
-    ${resp}   Delete    session   ${REST_CON}/node/openflow:1/table/0/flow/152    
+    ${resp}    Delete    session    ${REST_CON}/node/openflow:1/table/0/flow/152
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Verify after deleting flow config - Output to physical port#
     [Documentation]    Verify the flow
-    [Tags]   Get
-    ${resp}    Get    session     ${REST_CON}/node/openflow:1/table/0
+    [Tags]    Get
+    ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/0
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Not Contain     ${resp.content}    152
+    Should Not Contain    ${resp.content}    152
+    #    Standing bug #368 - This has been fixed
 
-#    Standing bug #368 - This has been fixed
 Verify after deleting flow operational - Output to physical port#
     [Documentation]    Verify the flow
-    [Tags]   Get
-    Sleep    40
-    ${resp}    Get    session     ${REST_OPR}/node/openflow:1/table/0
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Not Contain     ${resp.content}    10.0.20.1
-
+    [Tags]    Get
+    ${elements}=    Create List    10.0.20.1
+    Wait Until Keyword Succeeds    40s    2s    Check For Elements Not At URI    ${REST_OPR}/node/openflow:1/table/0    ${elements}