replacing ConfigViaRestconf for TempletedRequests in tcpmd5 suite for Be
[integration/test.git] / csit / suites / bgpcep / tcpmd5user / tcpmd5user.robot
index d3cad0f210e46f7edadabe38ff9924d83c5d235b..2961cc3fc85f9ed18e23222cafca93a47da2400f 100644 (file)
@@ -18,14 +18,14 @@ Library           OperatingSystem
 Library           RequestsLibrary
 Library           SSHLibrary    prompt=]>
 Library           String
-Library           ${CURDIR}/../../../libraries/HsfJson/hsf_json.py
-Resource          ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
+Library           ${CURDIR}/../../../libraries/norm_json.py
 Resource          ${CURDIR}/../../../libraries/FailFast.robot
 Resource          ${CURDIR}/../../../libraries/NexusKeywords.robot
 Resource          ${CURDIR}/../../../libraries/PcepOperations.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
 Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
 Variables         ${CURDIR}/../../../variables/Variables.py
-Variables         ${CURDIR}/../../../variables/pcepuser/variables.py    ${MININET}
+Variables         ${CURDIR}/../../../variables/pcepuser/variables.py    ${TOOLS_SYSTEM_IP}
 
 *** Variables ***
 ${directory_for_actual_responses}    ${TEMPDIR}${/}actual
@@ -41,7 +41,7 @@ Topology_Precondition
 
 Start_Secure_Pcc_Mock
     [Documentation]    Execute pcc-mock on Mininet with password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases.
-    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --password topsecret --reconnect 1 --local-address ${MININET} --remote-address ${CONTROLLER} 2>&1 | tee pccmock.log
+    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --password topsecret --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
     BuiltIn.Log    ${command}
     SSHLibrary.Write    ${command}
     Read_And_Fail_If_Prompt_Is_Seen
@@ -51,36 +51,6 @@ Topology_Unauthorized_1
     [Tags]    critical
     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s    Compare_Topology    ${off_json}    020_Unauthorized_1.json
 
-Enable_Tcpmd5_No_Password_Yet
-    [Documentation]    Send series of restconf puts derived from https://wiki.opendaylight.org/view/BGP_LS_PCEP:TCP_MD5_Guide#RESTCONF_Configuration
-    ...    Every put should return empty text with allwed status code.
-    # No ${mapping_as_string} is given, as there are no placeholders present in the following folders.
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}key_access_module
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}key_access_service
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}md5_client_channel_module
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}md5_client_channel_service
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}md5_server_channel_module
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}md5_server_channel_service
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}pcep_client_channel_module
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}pcep_server_channel_module
-    # TODO: Is it worth changing ConfigViaRestconf to read ${directory_with_template_folders} variable by default?
-
-Check_For_Bug_3753_Via_Bug_4267
-    [Documentation]    Check state of disptcher configuration module, apply workaround if needed.
-    ...    This test case should not be failing, failure indicates Bug 3753 was not fixed enough yet.
-    ...    For more details, see https://bugs.opendaylight.org/show_bug.cgi?id=4267#c2
-    ...    As dispatcher configuration differs between Lithium and Beryllium, two checks and two workarounds are needed.
-    ${success}=    BuiltIn.Run_Keyword_And_Return_Status    ConfigViaRestconf.Verify_Json_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}pcep_dispatcher_module
-    BuiltIn.Pass_Execution_If    ${success}    Bug 4267 not present, Beryllium data.
-    ${success}=    BuiltIn.Run_Keyword_And_Return_Status    ConfigViaRestconf.Verify_Json_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}lithium_pcep_dispatcher_module
-    BuiltIn.Pass_Execution_If    ${success}    Bug 4267 not present, Lithium data.
-    ${success}=    BuiltIn.Run_Keyword_And_Return_Status    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}pcep_dispatcher_module
-    BuiltIn.Run_Keyword_If    ${success}    BuiltIn.Fail    Bug 4267 present, Beryllium workaround successful.
-    ${success}=    BuiltIn.Run_Keyword_And_Return_Status    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}lithium_pcep_dispatcher_module
-    BuiltIn.Run_Keyword_If    ${success}    BuiltIn.Fail    Bug 4267 present, Lithium workaround successful.
-    BuiltIn.Fail    Bug 4267 probably present. No workaround succeeded, so Bug 4491 is probably present too.
-    [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
-
 Topology_Unauthorized_2
     [Documentation]    The same logic as Topology_Unauthorized_1 as no password was provided to ODL.
     [Tags]    critical
@@ -161,7 +131,7 @@ Set_It_Up
     ${current_prompt}=    BuiltIn.Set_Variable    ${current_connection.prompt}
     BuiltIn.Log    ${current_prompt}
     BuiltIn.Set_Suite_Variable    ${prompt}    ${current_prompt}
-    RequestsLibrary.Create_Session    ses    http://${CONTROLLER}:${RESTCONFPORT}${OPERATIONAL_TOPO_API}    auth=${AUTH}
+    RequestsLibrary.Create_Session    ses    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_TOPO_API}    auth=${AUTH}
     ${name}=    NexusKeywords.Deploy_Test_Tool    bgpcep    pcep-pcc-mock
     BuiltIn.Set_Suite_Variable    ${filename}    ${name}
     OperatingSystem.Remove_Directory    ${directory_for_expected_responses}    recursive=True
@@ -169,7 +139,7 @@ Set_It_Up
     # The previous suite may have been using the same directories.
     OperatingSystem.Create_Directory    ${directory_for_expected_responses}
     OperatingSystem.Create_Directory    ${directory_for_actual_responses}
-    ConfigViaRestconf.Setup_Config_Via_Restconf
+    TemplatedRequests.Create_Default_Session
     PcepOperations.Setup_Pcep_Operations
     FailFast.Do_Not_Fail_Fast_From_Now_On
 
@@ -183,7 +153,6 @@ Tear_It_Down
     ${diff}=    OperatingSystem.Run    diff -dur ${directory_for_expected_responses} ${directory_for_actual_responses}
     BuiltIn.Log    ${diff}
     PcepOperations.Teardown_Pcep_Operations
-    ConfigViaRestconf.Teardown_Config_Via_Restconf
     RequestsLibrary.Delete_All_Sessions
     SSHLibrary.Close_All_Connections
 
@@ -203,13 +172,13 @@ Compare_Topology
     ...    Save normalized jsons to files for later processing.
     ...    Error codes and normalized jsons should match exactly.
     # FIXME: See bgpuser to move handling of expected outside WUKS loop, as in bgpuser suite.
-    ${normexp}=    hsf_json.Hsf_Json    ${expected}
+    ${normexp}=    norm_json.normalize_json_text    ${expected}
     BuiltIn.Log    ${normexp}
     OperatingSystem.Create_File    ${directory_for_expected_responses}${/}${name}    ${normexp}
     ${resp}=    RequestsLibrary.Get_Request    ses    topology/pcep-topology
     BuiltIn.Log    ${resp}
     BuiltIn.Log    ${resp.text}
-    ${normresp}=    hsf_json.Hsf_Json    ${resp.text}
+    ${normresp}=    norm_json.normalize_json_text    ${resp.text}
     BuiltIn.Log    ${normresp}
     OperatingSystem.Create_File    ${directory_for_actual_responses}${/}${name}    ${normresp}
     BuiltIn.Should_Be_Equal_As_Strings    ${resp.status_code}    200
@@ -225,6 +194,5 @@ Construct_Password_Element_Line_Using_Password
 Replace_Password_Xml_Element_In_Pcep_Client_Module
     [Arguments]    ${password_element}
     [Documentation]    Send restconf PUT to replace the config module specifying PCEP password element (may me empty=missing).
-    ${mapping_as_string}=    BuiltIn.Set_Variable    {'IP': '${MININET}', 'PASSWD': '''${password_element}'''}
-    BuiltIn.Log    ${mapping_as_string}
-    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${directory_with_template_folders}${/}pcep_topology_client_module    ${mapping_as_string}
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    PASSWD=${password_element}
+    TemplatedRequests.Put_As_Xml_Templated    ${directory_with_template_folders}${/}pcep_topology_client_module    mapping=${mapping}