X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FConfigViaRestconf.robot;h=384356357f41e274e26e1323e5fd13ecb7d6706d;hb=dd8f2cc400082ac6b70a8644de0243d1f83dc21d;hp=d0e42945a9c84c24ebfb7bb4353c746fc11e71e1;hpb=af10a8780c93a7ac8b8fde288b776cf98e04582a;p=integration%2Ftest.git diff --git a/csit/libraries/ConfigViaRestconf.robot b/csit/libraries/ConfigViaRestconf.robot index d0e42945a9..384356357f 100644 --- a/csit/libraries/ConfigViaRestconf.robot +++ b/csit/libraries/ConfigViaRestconf.robot @@ -28,13 +28,10 @@ Documentation Robot keyword library (Resource) for runtime changes to config ... * netconf-connector feature installed on ODL. ... * Setup_Config_Via_Restconf called from suite Setup ... (or before any other call to a keyword from this library) at least once. -... -... FIXME: This module needs merging with NetconfViaRestconf.robot and fixing. -... See comments in NetconfViaRestconf.robot for more details. Library OperatingSystem Library RequestsLibrary Library String -Library ${CURDIR}/HsfJson/hsf_json.py +Library ${CURDIR}/norm_json.py Variables ${CURDIR}/../variables/Variables.py *** Variables *** @@ -95,14 +92,14 @@ Verify_Json_Template_Folder_Config_Via_Restconf [Documentation] Resolve URI from folder, GET from controller config, compare to expected data as normalized JSONs. ${expected}= Resolve_Json_Data_From_Template_Folder ${folder} ${mapping_as_string} ${actual}= Get_Json_Template_Folder_Config_Via_Restconf ${folder} ${mapping_as_string} - Normalize_Jsons_And_Compare ${actual} ${expected} + Normalize_Jsons_Save_And_Compare ${actual} ${expected} -Normalize_Jsons_And_Compare +Normalize_Jsons_Save_And_Compare [Arguments] ${actual_raw} ${expected_raw} [Documentation] Use HsfJson to normalize both arguments, compute and Log diff, fail if diff is non-empty. ... This keywords assumes ${WORKSPACE} is defined as a suite variable. - ${actual_normalized}= hsf_json.Hsf_Json ${actual_raw} - ${expected_normalized}= hsf_json.Hsf_Json ${expected_raw} + ${actual_normalized}= norm_json.normalize_json_text ${actual_raw} + ${expected_normalized}= norm_json.normalize_json_text ${expected_raw} OperatingSystem.Create_File ${cvr_expfile} ${expected_normalized} OperatingSystem.Create_File ${cvr_actfile} ${actual_normalized} ${diff}= OperatingSystem.Run diff -du '${cvr_expfile}' '${cvr_actfile}' @@ -118,7 +115,9 @@ Delete_Xml_Template_Folder_Config_Via_Restconf Resolve_URI_From_Template_Folder [Arguments] ${folder} ${mapping_as_string} [Documentation] Read URI template from folder, strip endline, make changes according to mapping, return the result. - ${uri_template}= OperatingSystem.Get_File ${folder}${/}config.uri + ${status} ${uri_template}= BuiltIn.Run_Keyword_And_Ignore_Error OperatingSystem.Get_File ${folder}${/}config.uri.${ODL_STREAM} + ${uri_template}= BuiltIn.Run Keyword If '${status}' != 'PASS' OperatingSystem.Get_File ${folder}${/}config.uri + ... ELSE BuiltIn.Set Variable ${uri_template} BuiltIn.Log ${uri_template} ${uri_part}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${uri_template} ${mapping_as_string} [Return] ${uri_part} @@ -126,7 +125,9 @@ Resolve_URI_From_Template_Folder Resolve_Xml_Data_From_Template_Folder [Arguments] ${folder} ${mapping_as_string} [Documentation] Read XML data template from folder, strip endline, make changes according to mapping, return the result. - ${data_template}= OperatingSystem.Get_File ${folder}${/}data.xml + ${status} ${data_template}= BuiltIn.Run_Keyword_And_Ignore_Error OperatingSystem.Get_File ${folder}${/}data.xml.${ODL_STREAM} + ${data_template}= BuiltIn.Run Keyword If '${status}' != 'PASS' OperatingSystem.Get_File ${folder}${/}data.xml + ... ELSE BuiltIn.Set Variable ${data_template} BuiltIn.Log ${data_template} ${xml_data}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${data_template} ${mapping_as_string} [Return] ${xml_data} @@ -134,7 +135,9 @@ Resolve_Xml_Data_From_Template_Folder Resolve_Json_Data_From_Template_Folder [Arguments] ${folder} ${mapping_as_string} [Documentation] Read JSON data template from folder, strip endline, make changes according to mapping, return the result. - ${data_template}= OperatingSystem.Get_File ${folder}${/}data.json + ${status} ${data_template}= BuiltIn.Run_Keyword_And_Ignore_Error OperatingSystem.Get_File ${folder}${/}data.json.${ODL_STREAM} + ${data_template}= BuiltIn.Run Keyword If '${status}' != 'PASS' OperatingSystem.Get_File ${folder}${/}data.json + ... ELSE BuiltIn.Set Variable ${data_template} BuiltIn.Log ${data_template} ${json_data}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${data_template} ${mapping_as_string} [Return] ${json_data}