From 502b2f80d1b9e30f39e9ad9d5dfcb6ad6811300e Mon Sep 17 00:00:00 2001 From: Luis Gomez Date: Mon, 14 Dec 2015 20:32:52 -0800 Subject: [PATCH] Update cluster suite to use json sort keyword. Change-Id: Ifaf88dfe860255e315a8ee0e54d9c24eac7c8570 Signed-off-by: Luis Gomez --- csit/libraries/ClusterKeywords.robot | 7 +++-- csit/libraries/ClusterOvsdb.robot | 44 +--------------------------- 2 files changed, 5 insertions(+), 46 deletions(-) diff --git a/csit/libraries/ClusterKeywords.robot b/csit/libraries/ClusterKeywords.robot index a77228a021..82b39418b1 100644 --- a/csit/libraries/ClusterKeywords.robot +++ b/csit/libraries/ClusterKeywords.robot @@ -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} diff --git a/csit/libraries/ClusterOvsdb.robot b/csit/libraries/ClusterOvsdb.robot index d6a6ce737d..1df0c263e3 100644 --- a/csit/libraries/ClusterOvsdb.robot +++ b/csit/libraries/ClusterOvsdb.robot @@ -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} -- 2.36.6