Update cluster suite to use json sort keyword. 25/31325/4
authorLuis Gomez <ecelgp@gmail.com>
Tue, 15 Dec 2015 04:32:52 +0000 (20:32 -0800)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 18 Dec 2015 17:34:29 +0000 (17:34 +0000)
Change-Id: Ifaf88dfe860255e315a8ee0e54d9c24eac7c8570
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
csit/libraries/ClusterKeywords.robot
csit/libraries/ClusterOvsdb.robot

index a77228a0215ac49583d0ca5b8eac1fd219c958ba..82b39418b1e673182fd8e7eda250f2dc92359b29 100644 (file)
@@ -3,6 +3,7 @@ Library           RequestsLibrary
 Library           Collections
 Library           UtilLibrary.py
 Library           ClusterStateLibrary.py
+Library           ./HsfJson/hsf_json.py
 Resource          Utils.robot
 
 *** Variables ***
@@ -93,15 +94,15 @@ Put And Check At URI In Cluster
     [Arguments]    ${controller_index_list}    ${controller_index}    ${uri}    ${body}    ${headers}=${HEADERS}
     [Documentation]    Send a PUT with the supplied ${uri} and ${body} to a ${controller_index}
     ...    and check the data is replicated in all instances in ${controller_index_list}.
-    ${expected_body}=    To Json    ${body}
+    ${expected_body}=    Hsf Json    ${body}
     ${resp}    RequestsLibrary.Put Request    controller${controller_index}    ${uri}    ${body}    ${headers}
     Should Be Equal As Strings    ${resp.status_code}    200
     : FOR    ${i}    IN    @{controller_index_list}
     \    ${data}    Wait Until Keyword Succeeds    5s    1s    Get Data From URI    controller${i}
     \    ...    ${uri}    ${headers}
     \    Log    ${data}
-    \    ${received_body}    To Json    ${data}
-    \    Should Be Equal    ${received_body}    ${expected_body}
+    \    ${received_body}    Hsf Json    ${data}
+    \    Should Be Equal    ${expected_body}    ${received_body}
 
 Delete And Check At URI In Cluster
     [Arguments]    ${controller_index_list}    ${controller_index}    ${uri}    ${headers}=${HEADERS}
index d6a6ce737d09937530669b046a4ebd2bbc45f26c..1df0c263e32c1d9182674d357f49cb117b59df53 100644 (file)
@@ -75,47 +75,5 @@ Create Bridge And Verify
     ${body}    Replace String    ${sample5}    61644    ${OVSDB_PORT}
     Log    ${body}
     ${dictionary}=    Create Dictionary    ${MININET}=1    ${OVSDBPORT}=4    ${BRIDGE}=1
-    Put And Check At URI In Cluster Ovsdb    ${controller_index_list}    ${controller_index}    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    ${body}    ${HEADERS}
+    Put And Check At URI In Cluster    ${controller_index_list}    ${controller_index}    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    ${body}    ${HEADERS}
     Wait Until Keyword Succeeds    5s    1s    Check Item Occurrence At URI In Cluster    ${controller_index_list}    ${dictionary}    ${OPERATIONAL_TOPO_API}
-
-Put And Check At URI In Cluster Ovsdb
-    [Arguments]    ${controller_index_list}    ${controller_index}    ${uri}    ${body}    ${headers}=${HEADERS}
-    [Documentation]    Send a PUT with the supplied ${uri} and ${body} to a ${controller_index}
-    ...    and check the data is replicated in all instances in ${controller_index_list}.
-    ${expected_body}=    To Json    ${body}
-    ${resp}    RequestsLibrary.Put Request    controller${controller_index}    ${uri}    ${body}    ${headers}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    : FOR    ${i}    IN    @{controller_index_list}
-    \    ${data}    Wait Until Keyword Succeeds    5s    1s    Get Data From URI    controller${i}
-    \    ...    ${uri}    ${headers}
-    \    Log    ${data}
-    \    ${received_body}    To Json    ${data}
-    \    Check Expected And Received Body    ${expected_body}    ${received_body}
-
-Check Expected And Received Body
-    [Arguments]    ${expected_body}    ${received_body}
-    [Documentation]    Checks whether the expected data and the actual received data are equal.
-    Log    ${expected_body}
-    Log    ${received_body}
-    ${content1}    Get From Dictionary    ${expected_body}    node
-    Log    ${content1}
-    ${node1}    Get From List    ${content1}    0
-    Log    ${node1}
-    ${expected_bridge_name}    Get From Dictionary    ${node1}    ovsdb:bridge-name
-    Log    ${expected_bridge_name}
-    ${expected_target_ips}    Get From Dictionary    ${node1}    ovsdb:controller-entry
-    Log    ${expected_target_ips}
-    Sort List    ${expected_target_ips}
-    Log    ${expected_target_ips}
-    ${content2}    Get From Dictionary    ${received_body}    node
-    Log    ${content2}
-    ${node2}    Get From List    ${content2}    0
-    Log    ${node2}
-    ${received_bridge_name}    Get From Dictionary    ${node2}    ovsdb:bridge-name
-    Log    ${received_bridge_name}
-    ${received_target_ips}    Get From Dictionary    ${node2}    ovsdb:controller-entry
-    Log    ${received_target_ips}
-    Sort List    ${received_target_ips}
-    Log    ${received_target_ips}
-    Should Be Equal As Strings    ${received_bridge_name}    ${expected_bridge_name}
-    Lists Should be Equal    ${received_target_ips}    ${expected_target_ips}