From: Jamo Luhrsen Date: Thu, 26 Mar 2020 18:51:32 +0000 (-0700) Subject: Combine common keywords and fix argument issue X-Git-Tag: pre-potassium~229 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=integration%2Ftest.git;a=commitdiff_plain;h=3d3169ffc82a65a2198d2dbd7f22d3636bb6564f Combine common keywords and fix argument issue https://git.opendaylight.org/gerrit/c/integration/test/+/88446 broke the getsingle.robot suite because it was duplicating some work that should be common. So combined the duplication between it and max_devices in to the netconfkeywords lib. getmulti.robot is also sharing keywords now. Also add back 300s timeout for Wait_Connected keyword that was migrated to NetconfKeywords.robot lib in parallel with the review/merge of https://git.opendaylight.org/gerrit/c/integration/test/+/88662 Signed-off-by: Jamo Luhrsen Change-Id: I063b6e13cdbafff778186043a2250da284365091 Signed-off-by: Jamo Luhrsen --- diff --git a/csit/libraries/NetconfKeywords.robot b/csit/libraries/NetconfKeywords.robot index bc692a3286..676f78b4c6 100644 --- a/csit/libraries/NetconfKeywords.robot +++ b/csit/libraries/NetconfKeywords.robot @@ -54,6 +54,21 @@ Configure_Device_In_Netconf ... ELSE TemplatedRequests.Put_As_Xml_Templated folder=${DIRECTORY_WITH_DEVICE_TEMPLATES}${/}${device_type} mapping=${mapping} session=${session} http_timeout=${http_timeout} Collections.Set_To_Dictionary ${NetconfKeywords__mounted_device_types} ${device_name} ${device_type} +Configure_Device + [Arguments] ${current_name} ${log_response}=True + [Documentation] Operation for configuring the device. + KarafKeywords.Log_Message_To_Controller_Karaf Configuring device ${current_name} to Netconf + Configure_Device_In_Netconf ${current_name} device_type=${device_type} device_port=${current_port} + KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} configured + +Configure_Device_And_Verify + [Arguments] ${current_name} ${log_response}=True + [Documentation] Operation for configuring the device in the Netconf subsystem and connecting to it. + Configure_Device ${current_name} ${log_response} + KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to connect + Wait_Device_Connected ${current_name} period=0.5s + KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} connected + Count_Netconf_Connectors_For_Device [Arguments] ${device_name} ${session}=default [Documentation] Count all instances of the specified device in the Netconf topology (usually 0 or 1). @@ -67,6 +82,13 @@ Count_Netconf_Connectors_For_Device ${actual_count}= Builtin.Evaluate len('''${mounts}'''.split('"node-id": "${device_name}"'))-1 Builtin.Return_From_Keyword ${actual_count} +Wait_Connected + [Arguments] ${current_name} ${log_response}=True + [Documentation] Operation for waiting until the device is connected. + KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to connect + Wait_Device_Connected ${current_name} period=0.5s timeout=300s + KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} connected + Check_Device_Has_No_Netconf_Connector [Arguments] ${device_name} ${session}=default [Documentation] Check that there are no instances of the specified device in the Netconf topology. @@ -105,6 +127,26 @@ Remove_Device_From_Netconf ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'} TemplatedRequests.Delete_Templated ${DIRECTORY_WITH_DEVICE_TEMPLATES}${/}${device_type} ${template_as_string} session=${session} location=${location} +Deconfigure_Device + [Arguments] ${current_name} ${log_response}=True + [Documentation] Operation for deconfiguring the device. + KarafKeywords.Log_Message_To_Controller_Karaf Deconfiguring device ${current_name} + Remove_Device_From_Netconf ${current_name} + KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} deconfigured + +Deconfigure_Device_And_Verify + [Arguments] ${current_name} ${log_response}=True + [Documentation] Operation for deconfiguring the device from Netconf. + Deconfigure_Device ${current_name} ${log_response} + Check_Device_Deconfigured ${current_name} + +Check_Device_Deconfigured + [Arguments] ${current_name} ${log_response}=True + [Documentation] Operation for making sure the device is really deconfigured. + KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to disappear + Wait_Device_Fully_Removed ${current_name} period=0.5s timeout=120s + KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} removed + Wait_Device_Fully_Removed [Arguments] ${device_name} ${timeout}=10s ${period}=1s ${session}=default ${log_response}=True [Documentation] Wait until all netconf connectors for the device with the given name disappear. diff --git a/csit/suites/netconf/scale/getmulti.robot b/csit/suites/netconf/scale/getmulti.robot index 0af1d4ceba..ad83d0fdc2 100644 --- a/csit/suites/netconf/scale/getmulti.robot +++ b/csit/suites/netconf/scale/getmulti.robot @@ -42,14 +42,15 @@ Start_Test_Tool Configure_Devices_On_Netconf [Documentation] Make requests to configure the testtool devices. ${timeout}= BuiltIn.Evaluate ${DEVICE_COUNT}*${TIMEOUT_FACTOR} - NetconfKeywords.Perform_Operation_On_Each_Device Configure_Device timeout=${timeout} + NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Configure_Device timeout=${timeout} Wait_For_Devices_To_Connect [Documentation] Wait for the devices to become connected. ${timeout}= BuiltIn.Evaluate ${DEVICE_COUNT}*${TIMEOUT_FACTOR} - NetconfKeywords.Perform_Operation_On_Each_Device Wait_Connected timeout=${timeout} + NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Wait_Connected timeout=${timeout} Issue_Requests_On_Devices + # FIXME: this test case is a keyword and nearly duplicated in the max_devices.robot suite. need to move it to a common lib [Documentation] Spawn the specified count of worker threads to issue a GET request to each of the devices. ${current_ssh_connection}= SSHLibrary.Get Connection SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} @@ -65,13 +66,13 @@ Issue_Requests_On_Devices Deconfigure_Devices [Documentation] Make requests to deconfigure the testtool devices. ${timeout}= BuiltIn.Evaluate ${DEVICE_COUNT}*${TIMEOUT_FACTOR} - NetconfKeywords.Perform_Operation_On_Each_Device Deconfigure_Device timeout=${timeout} + NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Deconfigure_Device timeout=${timeout} [Teardown] Report_Failure_Due_To_Bug 4547 Check_Devices_Are_Deconfigured [Documentation] Check there are no netconf connectors or other stuff related to the testtool devices. ${timeout}= BuiltIn.Evaluate ${DEVICE_COUNT}*${TIMEOUT_FACTOR} - NetconfKeywords.Perform_Operation_On_Each_Device Check_Device_Deconfigured timeout=${timeout} + NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Check_Device_Deconfigured timeout=${timeout} *** Keywords *** Setup_Everything @@ -92,20 +93,6 @@ Teardown_Everything RequestsLibrary.Delete_All_Sessions NetconfKeywords.Stop_Testtool -Configure_Device - [Arguments] ${current_name} - [Documentation] Operation for configuring the device. - KarafKeywords.Log_Message_To_Controller_Karaf Configuring device ${current_name} to Netconf - NetconfKeywords.Configure_Device_In_Netconf ${current_name} device_type=${device_type} device_port=${current_port} - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} configured - -Wait_Connected - [Arguments] ${current_name} - [Documentation] Operation for waiting until the device is connected. - KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to connect - NetconfKeywords.Wait_Device_Connected ${current_name} period=0.5s timeout=120s - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} connected - Read_Python_Tool_Operation_Result [Arguments] ${number} [Documentation] Read and process a report line emitted from the Python tool that corresponds to the device with the given number. @@ -121,17 +108,3 @@ Read_Python_Tool_Operation_Result ${data}= Collections.Get_From_List ${test} 4 ${expected}= BuiltIn.Set_Variable '' BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected} - -Deconfigure_Device - [Arguments] ${current_name} - [Documentation] Operation for deconfiguring the device. - KarafKeywords.Log_Message_To_Controller_Karaf Deconfiguring device ${current_name} - NetconfKeywords.Remove_Device_From_Netconf ${current_name} - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} deconfigured - -Check_Device_Deconfigured - [Arguments] ${current_name} - [Documentation] Operation for making sure the device is really deconfigured. - KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to disappear - NetconfKeywords.Wait_Device_Fully_Removed ${current_name} period=0.5s timeout=120s - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} removed diff --git a/csit/suites/netconf/scale/getsingle.robot b/csit/suites/netconf/scale/getsingle.robot index 63149efcda..b23f455c33 100644 --- a/csit/suites/netconf/scale/getsingle.robot +++ b/csit/suites/netconf/scale/getsingle.robot @@ -37,7 +37,7 @@ Configure_Devices_Onto_Netconf [Documentation] Make requests to configure the testtool devices. [Tags] critical ${timeout}= BuiltIn.Evaluate ${DEVICE_COUNT}*${TIMEOUT_FACTOR} - NetconfKeywords.Perform_Operation_On_Each_Device Configure_Device timeout=${timeout} + NetconfKeywords.Perform_Operation_On_Each_Device Configure_Device_And_Verify timeout=${timeout} Get_Data_From_Devices [Documentation] Ask testtool devices for data. @@ -48,7 +48,7 @@ Deconfigure_Devices_From_Netconf [Documentation] Make requests to deconfigure the testtool devices. [Tags] critical ${timeout}= BuiltIn.Evaluate ${DEVICE_COUNT}*${TIMEOUT_FACTOR} - NetconfKeywords.Perform_Operation_On_Each_Device Deconfigure_Device timeout=${timeout} + NetconfKeywords.Perform_Operation_On_Each_Device Deconfigure_Device_And_Verify timeout=${timeout} [Teardown] Report_Failure_Due_To_Bug 4547 *** Keywords *** @@ -69,28 +69,10 @@ Teardown_Everything RequestsLibrary.Delete_All_Sessions NetconfKeywords.Stop_Testtool -Configure_Device - [Arguments] ${current_name} - [Documentation] Operation for configuring the device in the Netconf subsystem and connecting to it. - KarafKeywords.Log_Message_To_Controller_Karaf Connecting device ${current_name} - NetconfKeywords.Configure_Device_In_Netconf ${current_name} device_type=${device_type} device_port=${current_port} - KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to connect - NetconfKeywords.Wait_Device_Connected ${current_name} period=0.5s - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} connected - Check_Device_Data - [Arguments] ${current_name} + [Arguments] ${current_name} ${log_response}=True [Documentation] Opration for getting the configuration data of the device and checking that it matches what is expected. KarafKeywords.Log_Message_To_Controller_Karaf Getting data from device ${current_name} ${data}= Utils.Get_Data_From_URI config network-topology:network-topology/topology/topology-netconf/node/${current_name}/yang-ext:mount headers=${ACCEPT_XML} KarafKeywords.Log_Message_To_Controller_Karaf Got data from device ${current_name} BuiltIn.Should_Be_Equal ${data} - -Deconfigure_Device - [Arguments] ${current_name} - [Documentation] Operation for deconfiguring the device from Netconf. - KarafKeywords.Log_Message_To_Controller_Karaf Removing device ${current_name} - NetconfKeywords.Remove_Device_From_Netconf ${current_name} - KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to disappear - NetconfKeywords.Wait_Device_Fully_Removed ${current_name} period=0.5s timeout=120s - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} removed diff --git a/csit/suites/netconf/scale/max_devices.robot b/csit/suites/netconf/scale/max_devices.robot index 1abaf35381..0090b5aea9 100644 --- a/csit/suites/netconf/scale/max_devices.robot +++ b/csit/suites/netconf/scale/max_devices.robot @@ -55,16 +55,16 @@ Find Max Netconf Devices Log To Console Starting Iteration with ${devices} devices Run Keyword If "${INSTALL_TESTTOOL}"=="True" NetconfKeywords.Install_And_Start_Testtool debug=false schemas=${schema_dir} device-count=${devices} ... ELSE NetconfKeywords.Start_Testtool ${TESTTOOL_EXECUTABLE} debug=false schemas=${schema_dir} device-count=${devices} - ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Configure_Device timeout=${timeout} + ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Configure_Device timeout=${timeout} Exit For Loop If '${status}' == 'FAIL' - ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Wait_Connected timeout=${timeout} log_response=False + ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Wait_Connected timeout=${timeout} log_response=False Exit For Loop If '${status}' == 'FAIL' ${status} ${result} = Run Keyword And Ignore Error Issue_Requests_On_Devices ${TOOLS_SYSTEM_IP} ${devices} ... ${NUM_WORKERS} Exit For Loop If '${status}' == 'FAIL' - ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Wait_Connected timeout=${timeout} log_response=False + ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Wait_Connected timeout=${timeout} log_response=False Exit For Loop If '${status}' == 'FAIL' - ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Deconfigure_Device timeout=${timeout} + ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device NetconfKeywords.Deconfigure_Device timeout=${timeout} Exit For Loop If '${status}' == 'FAIL' ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Check_Device_Deconfigured timeout=${timeout} log_response=False Exit For Loop If '${status}' == 'FAIL' @@ -84,6 +84,7 @@ Collect_Data_Points OperatingSystem.Append To File ${DEVICES_RESULT_FILE} ${devices}\n Issue_Requests_On_Devices + # FIXME: this keyword is nearly duplicated in the getmulti.robot suite. need to move it to a common lib [Arguments] ${client_ip} ${expected_count} ${worker_count} [Documentation] Spawn the specified count of worker threads to issue a GET request to each of the devices. ${current_ssh_connection}= SSHLibrary.Get Connection @@ -115,20 +116,6 @@ Teardown_Everything RequestsLibrary.Delete_All_Sessions NetconfKeywords.Stop_Testtool -Configure_Device - [Arguments] ${current_name} ${log_response}=True - [Documentation] Operation for configuring the device. - KarafKeywords.Log_Message_To_Controller_Karaf Configuring device ${current_name} to Netconf - NetconfKeywords.Configure_Device_In_Netconf ${current_name} device_type=${device_type} device_port=${current_port} - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} configured - -Wait_Connected - [Arguments] ${current_name} ${log_response}=True - [Documentation] Operation for waiting until the device is connected. - KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to connect - NetconfKeywords.Wait_Device_Connected ${current_name} period=0.5s timeout=300s log_response=${log_response} - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} connected - Read_Python_Tool_Operation_Result [Arguments] ${number} [Documentation] Read and process a report line emitted from the Python tool that corresponds to the device with the given number. @@ -145,13 +132,6 @@ Read_Python_Tool_Operation_Result ${expected}= BuiltIn.Set_Variable '' BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected} -Deconfigure_Device - [Arguments] ${current_name} ${log_response}=True - [Documentation] Operation for deconfiguring the device. - KarafKeywords.Log_Message_To_Controller_Karaf Deconfiguring device ${current_name} - NetconfKeywords.Remove_Device_From_Netconf ${current_name} - KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} deconfigured - Check_Device_Deconfigured [Arguments] ${current_name} ${log_response}=True [Documentation] Operation for making sure the device is really deconfigured.