SXP:Wait for conf->oper propagation in CRUD tests 36/62836/4
authorMartin Dindoffer <martin.dindoffer@pantheon.tech>
Thu, 7 Sep 2017 12:32:28 +0000 (14:32 +0200)
committerJamo Luhrsen <jluhrsen@redhat.com>
Sat, 9 Sep 2017 15:04:05 +0000 (15:04 +0000)
Use WUKS to wait for async propagation from config
DS to operational before failing basic CRUD tests

Change-Id: Ie4fb5f6cccc05af4e51ba1f3cfba9f1dcd53352b
Signed-off-by: Martin Dindoffer <martin.dindoffer@pantheon.tech>
csit/libraries/SxpLib.robot
csit/suites/sxp/basic/020_Restconf_CRUD.robot

index 6f4d5c977fa08c4ea61bddf7f1d9c56d05743387..314cb55c659852f11bcf94506c7ec59e34e99340 100644 (file)
@@ -233,6 +233,30 @@ Should Not Contain Connection
     ...    ${state}
     Should Not Be True    ${out}    Shouldn't have ${ip}:${port} ${mode} ${version}
 
+Bindings Should Contain
+    [Arguments]    ${sgt}    ${prefix}    ${db_source}=any
+    [Documentation]    Retrieves bindings and verifies they contain given binding
+    ${resp}    Get Bindings
+    Should Contain Binding    ${resp}    ${sgt}    ${prefix}    ${db_source}
+
+Bindings Should Not Contain
+    [Arguments]    ${sgt}    ${prefix}    ${db_source}=any
+    [Documentation]    Retrieves bindings and verifies they do not contain given binding
+    ${resp}    Get Bindings
+    Should Not Contain Binding    ${resp}    ${sgt}    ${prefix}    ${db_source}
+
+Connections Should Contain
+    [Arguments]    ${ip}    ${port}    ${mode}    ${version}    ${state}=none
+    [Documentation]    Retrieves connections and verifies they contain given connection
+    ${resp}    Get Connections
+    Should Contain Connection    ${resp}    ${ip}    ${port}    ${mode}    ${version}    ${state}
+
+Connections Should Not Contain
+    [Arguments]    ${ip}    ${port}    ${mode}    ${version}    ${state}=none
+    [Documentation]    Retrieves connections and verifies they do not contain given connection
+    ${resp}    Get Connections
+    Should Not Contain Connection    ${resp}    ${ip}    ${port}    ${mode}    ${version}    ${state}
+
 Setup Topology Complex
     [Arguments]    ${version}=version4    ${PASSWORD}=none
     : FOR    ${node}    IN RANGE    2    6
index e51773a714c709246f1767cb10323cb1da56524a..310d945de5926245052a7988dec28241cb8de5f7 100644 (file)
@@ -15,58 +15,51 @@ Test Add Binding
     [Tags]    Restconf CRUD    SXP
     ${resp}    Get Bindings
     Add Binding    5230    1.1.1.1/32
-    ${resp}    Get Bindings
-    Should Contain Binding    ${resp}    5230    1.1.1.1/32
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Contain    5230    1.1.1.1/32
     Add Binding    30    2001:0:0:0:0:0:0:0/128
-    ${resp}    Get Bindings
-    Should Contain Binding    ${resp}    30    2001:0:0:0:0:0:0:0/128
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Contain    30    2001:0:0:0:0:0:0:0/128
 
 Test Add Connection
     [Documentation]    Test if connections are added to Node
     [Tags]    Restconf CRUD    SXP
     Add Connection    version4    speaker    10.1.0.0    60000
-    ${resp}    Get Connections
-    Should Contain Connection    ${resp}    10.1.0.0    60000    speaker    version4
+    Wait Until Keyword Succeeds    3x    250ms    Connections Should Contain    10.1.0.0    60000    speaker
+    ...    version4
     Add Connection    version1    listener    105.12.0.50    64000
-    ${resp}    Get Connections
-    Should Contain Connection    ${resp}    105.12.0.50    64000    listener    version1
+    Wait Until Keyword Succeeds    3x    250ms    Connections Should Contain    105.12.0.50    64000    listener
+    ...    version1
 
 Test Delete Binding
     [Documentation]    Test if bindings are deleted from Master DB
     [Tags]    Restconf CRUD    SXP
     Add Binding    52301    12.1.1.1/32
-    ${resp}    Get Bindings
-    Should Contain Binding    ${resp}    52301    12.1.1.1/32
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Contain    52301    12.1.1.1/32
     Run Keyword And Expect Error    *    Delete Binding    2631    12.1.1.1/32
-    ${resp}    Get Bindings
-    Should Contain Binding    ${resp}    52301    12.1.1.1/32
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Contain    52301    12.1.1.1/32
     Delete Binding    52301    12.1.1.1/32
-    ${resp}    Get Bindings
-    Should Not Contain Binding    ${resp}    52301    12.1.1.1/32
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Not Contain    52301    12.1.1.1/32
 
 Test Delete Connection
     [Documentation]    Test if conncetions are removed from Node
     [Tags]    Restconf CRUD    SXP
     Add Connection    version4    speaker    127.1.0.30    60000
-    ${resp}    Get Connections
-    Should Contain Connection    ${resp}    127.1.0.30    60000    speaker    version4
+    Wait Until Keyword Succeeds    3x    250ms    Connections Should Contain    127.1.0.30    60000    speaker
+    ...    version4
     Run Keyword And Expect Error    *    Delete Connections    127.1.0.30    65000
-    ${resp}    Get Connections
-    Should Contain Connection    ${resp}    127.1.0.30    60000    speaker    version4
+    Wait Until Keyword Succeeds    3x    250ms    Connections Should Contain    127.1.0.30    60000    speaker
+    ...    version4
     Delete Connections    127.1.0.30    60000
-    ${resp}    Get Connections
-    Should Not Contain Connection    ${resp}    127.1.0.30    60000    speaker    version4
+    Wait Until Keyword Succeeds    3x    250ms    Connections Should Not Contain    127.1.0.30    60000    speaker
+    ...    version4
 
 Test Update Binding
     [Documentation]    Test if bindings can be updated to different values
     [Tags]    Restconf CRUD    SXP
     Add Binding    3230    1.1.1.10/32
-    ${resp}    Get Bindings
-    Should Contain Binding    ${resp}    3230    1.1.1.10/32
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Contain    3230    1.1.1.10/32
     Update Binding    3230    1.1.1.10/32    623    10.10.10.10/32
-    ${resp}    Get Bindings
-    Should Not Contain Binding    ${resp}    3230    1.1.1.10/32
-    Should Contain Binding    ${resp}    623    10.10.10.10/32
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Not Contain    3230    1.1.1.10/32
+    Wait Until Keyword Succeeds    3x    250ms    Bindings Should Contain    623    10.10.10.10/32
 
 *** Keywords ***
 Clean Node