X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FGenius.robot;h=6080bfc800778e08c98d17bf223e92e11af135a1;hb=94651ca9711d8eb316721775561e815830bc6c7e;hp=9ae035ffc5625dd0e1c34891edf97c705ca13cfa;hpb=274f5deb599a6c358a572922877c2f777f5f94a5;p=integration%2Ftest.git diff --git a/csit/libraries/Genius.robot b/csit/libraries/Genius.robot index 9ae035ffc5..6080bfc800 100644 --- a/csit/libraries/Genius.robot +++ b/csit/libraries/Genius.robot @@ -4,288 +4,240 @@ Library Collections Library OperatingSystem Library RequestsLibrary Library SSHLibrary -Library re Library string +Resource ClusterManagement.robot +Resource CompareStream.robot +Resource DataModels.robot Resource KarafKeywords.robot +Resource ODLTools.robot +Resource OVSDB.robot +Resource ToolsSystem.robot Resource Utils.robot +Resource VpnOperations.robot Resource ../variables/Variables.robot -Resource OVSDB.robot Resource ../variables/netvirt/Variables.robot -Resource VpnOperations.robot -Resource DataModels.robot *** Variables *** @{itm_created} TZA ${genius_config_dir} ${CURDIR}/../variables/genius -${Bridge-1} BR1 -${Bridge-2} BR2 +${Bridge} ${INTEGRATION_BRIDGE} ${DEFAULT_MONITORING_INTERVAL} Tunnel Monitoring Interval (for VXLAN tunnels): 1000 -@{GENIUS_DIAG_SERVICES} OPENFLOW IFM ITM DATASTORE -${vlan} 0 -${gateway-ip} 0.0.0.0 +@{GENIUS_DIAG_SERVICES} OPENFLOW IFM ITM DATASTORE OVSDB +${gateway_ip} 0.0.0.0 +${port_name} br-int-eth1 +${VLAN} 100 +${NO_VLAN} 0 +${DEFAULT_TRANSPORT_ZONE} default-transport-zone +${SET_LOCAL_IP} sudo ovs-vsctl set O . other_config:local_ip= +${REMOVE_LOCAL_IP} sudo ovs-vsctl remove O . other_config local_ip +${odl_stream_check } &{Stream_dict}[${ODL_STREAM}] <= &{Stream_dict}[neon] *** Keywords *** Genius Suite Setup [Documentation] Create Rest Session to http://${ODL_SYSTEM_IP}:${RESTCONFPORT} - Start Suite - Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} timeout=5 + Genius.Start Suite + RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} timeout=5 Genius Suite Teardown [Documentation] Delete all sessions - Delete All Sessions - Stop Suite + RequestsLibrary.Delete All Sessions + Genius.Stop Suite Start Suite [Documentation] Initial setup for Genius test suites - Run_Keyword_If_At_Least_Oxygen Wait Until Keyword Succeeds 60 2 Check System Status @{GENIUS_DIAG_SERVICES} - Log Start the tests - ${conn_id_1}= Open Connection ${TOOLS_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=30s - Set Global Variable ${conn_id_1} + Run_Keyword_If_At_Least_Oxygen Wait Until Keyword Succeeds 60 2 ClusterManagement.Check Status Of Services Is OPERATIONAL @{GENIUS_DIAG_SERVICES} KarafKeywords.Setup_Karaf_Keywords - ${karaf_debug_enabled} BuiltIn.Get_Variable_Value ${KARAF_DEBUG} ${False} + ToolsSystem.Get Tools System Nodes Data + ${karaf_debug_enabled} = BuiltIn.Get_Variable_Value ${KARAF_DEBUG} ${False} BuiltIn.run_keyword_if ${karaf_debug_enabled} KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set DEBUG org.opendaylight.genius - BuiltIn.Run Keyword And Ignore Error KarafKeywords.Log_Test_Suite_Start_To_Controller_Karaf - Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/${SSH_KEY} any - Log ${conn_id_1} - Execute Command sudo ovs-vsctl add-br BR1 - Execute Command sudo ovs-vsctl set bridge BR1 protocols=OpenFlow13 - Execute Command sudo ovs-vsctl set-controller BR1 tcp:${ODL_SYSTEM_IP}:6633 - Execute Command sudo ifconfig BR1 up - Execute Command sudo ovs-vsctl add-port BR1 tap8ed70586-6c -- set Interface tap8ed70586-6c type=tap - Execute Command sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640 - ${output_1} Execute Command sudo ovs-vsctl show - Log ${output_1} - ${check} Wait Until Keyword Succeeds 30 10 check establishment ${conn_id_1} 6633 - log ${check} - ${check_2} Wait Until Keyword Succeeds 30 10 check establishment ${conn_id_1} 6640 - log ${check_2} - Log >>>>>Switch 2 configuration <<<<< - ${conn_id_2}= Open Connection ${TOOLS_SYSTEM_2_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=30s - Set Global Variable ${conn_id_2} - Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/${SSH_KEY} any - Log ${conn_id_2} - Execute Command sudo ovs-vsctl add-br BR2 - Execute Command sudo ovs-vsctl set bridge BR2 protocols=OpenFlow13 - Execute Command sudo ovs-vsctl set-controller BR2 tcp:${ODL_SYSTEM_IP}:6633 - Execute Command sudo ifconfig BR2 up - Execute Command sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640 - ${output_2} Execute Command sudo ovs-vsctl show - Log ${output_2} + Genius.Set Switch Configuration + ${check} = BuiltIn.Wait Until Keyword Succeeds 30 10 Check Port Status Is ESTABLISHED ${ODL_OF_PORT_6653} @{TOOLS_SYSTEM_ALL_IPS} + ${check} = BuiltIn.Wait Until Keyword Succeeds 30 10 Check Port Status Is ESTABLISHED ${OVSDBPORT} @{TOOLS_SYSTEM_ALL_IPS} + Genius.Build Dpn List + @{SWITCH_DATA} = Collections.Combine Lists ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS} + BuiltIn.Set Suite Variable @{SWITCH_DATA} + ${substr} Should Match Regexp ${TOOLS_SYSTEM_1_IP} [0-9]\{1,3}\.[0-9]\{1,3}\.[0-9]\{1,3}\. + ${SUBNET} = Catenate ${substr}0 + BuiltIn.Set Suite Variable ${SUBNET} Stop Suite - Log Stop the tests - Switch Connection ${conn_id_1} - Log ${conn_id_1} - Execute Command sudo ovs-vsctl del-br BR1 - Execute Command sudo ovs-vsctl del-manager - Write exit - close connection - Switch Connection ${conn_id_2} - Log ${conn_id_2} - Execute Command sudo ovs-vsctl del-br BR2 - Execute Command sudo ovs-vsctl del-manager - Write exit - close connection - -check establishment - [Arguments] ${conn_id} ${port} - Switch Connection ${conn_id} - ${check_establishment} Execute Command netstat -anp | grep ${port} - Should contain ${check_establishment} ESTABLISHED + [Documentation] stops all connections and deletes all the bridges available on OVS + FOR ${tool_system_index} IN RANGE ${NUM_TOOLS_SYSTEM} + SSHLibrary.Switch Connection @{TOOLS_SYSTEM_ALL_CONN_IDS}[${tool_system_index}] + SSHLibrary.Execute Command sudo ovs-vsctl del-br ${Bridge} + SSHLibrary.Execute Command sudo ovs-vsctl del-manager + SSHLibrary.Write exit + SSHLibrary.Close Connection + END + +Check Port Status Is ESTABLISHED + [Arguments] ${port} @{tools_ips} + [Documentation] This keyword will check whether ports are established or not on OVS + FOR ${tools_ip} IN @{tools_ips} + ${check_establishment} = Utils.Run Command On Remote System And Log ${tools_ip} netstat -anp | grep ${port} + BuiltIn.Should Contain ${check_establishment} ESTABLISHED + END [Return] ${check_establishment} -Check Service Status - [Arguments] ${odl_ip} ${system_ready_state} ${service_state} @{service_list} - [Documentation] Issues the karaf shell command showSvcStatus to verify the ready and service states are the same as the arguments passed - ${service_status_output} = Run Keyword If ${NUM_ODL_SYSTEM} > 1 Issue_Command_On_Karaf_Console showSvcStatus -n ${odl_ip} ${odl_ip} ${KARAF_SHELL_PORT} - ... ELSE Issue_Command_On_Karaf_Console showSvcStatus ${odl_ip} ${KARAF_SHELL_PORT} - Should Contain ${service_status_output} ${system_ready_state} - : FOR ${service} IN @{service_list} - \ Should Match Regexp ${service_status_output} ${service} +: ${service_state} - Create Vteps - [Arguments] ${Dpn_id_1} ${Dpn_id_2} ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip} - [Documentation] This keyword creates VTEPs between ${TOOLS_SYSTEM_IP} and ${TOOLS_SYSTEM_2_IP} - ${body} OperatingSystem.Get File ${genius_config_dir}/Itm_creation_no_vlan.json - ${substr} Should Match Regexp ${TOOLS_SYSTEM_IP} [0-9]\{1,3}\.[0-9]\{1,3}\.[0-9]\{1,3}\. - ${subnet} Catenate ${substr}0 - Log ${subnet} - Set Global Variable ${subnet} - ${vlan}= Set Variable ${vlan} - ${gateway-ip}= Set Variable ${gateway-ip} - ${body} Genius.Set Json ${Dpn_id_1} ${Dpn_id_2} ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} - ... ${gateway-ip} ${subnet} - ${vtep_body} Set Variable ${body} - Set Global Variable ${vtep_body} - ${resp} RequestsLibrary.Post Request session ${CONFIG_API}/itm:transport-zones/ data=${body} - Log ${resp.status_code} - should be equal as strings ${resp.status_code} 204 + [Arguments] ${vlan_id} ${gateway_ip} + [Documentation] This keyword creates VTEPs between OVS + ${body} = Genius.Set Json ${vlan_id} ${gateway_ip} ${SUBNET} @{TOOLS_SYSTEM_ALL_IPS} + ${resp} = RequestsLibrary.Put Request session ${CONFIG_API}/itm:transport-zones/transport-zone/TZA data=${body} + BuiltIn.Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code} Set Json - [Arguments] ${Dpn_id_1} ${Dpn_id_2} ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip} - ... ${subnet} + [Arguments] ${vlan} ${gateway_ip} ${subnet} @{tools_ips} [Documentation] Sets Json with the values passed for it. - ${body} OperatingSystem.Get File ${genius_config_dir}/Itm_creation_no_vlan.json - ${body} replace string ${body} 1.1.1.1 ${subnet} - ${body} replace string ${body} "dpn-id": 101 "dpn-id": ${Dpn_id_1} - ${body} replace string ${body} "dpn-id": 102 "dpn-id": ${Dpn_id_2} - ${body} replace string ${body} "ip-address": "2.2.2.2" "ip-address": "${TOOLS_SYSTEM_IP}" - ${body} replace string ${body} "ip-address": "3.3.3.3" "ip-address": "${TOOLS_SYSTEM_2_IP}" - ${body} replace string ${body} "vlan-id": 0 "vlan-id": ${vlan} - ${body} replace string ${body} "gateway-ip": "0.0.0.0" "gateway-ip": "${gateway-ip}" - Log ${body} + ${body} = BuiltIn.Run Keyword If ${odl_stream_check } OperatingSystem.Get File ${genius_config_dir}/Itm_creation_no_vlan_below_sodium.json + ... ELSE OperatingSystem.Get File ${genius_config_dir}/Itm_creation_no_vlan_sodium_and_above.json + ${body} = BuiltIn.Run Keyword If ${odl_stream_check } String.Replace String ${body} 1.1.1.1 ${subnet} + ... ELSE BuiltIn.Set Variable ${body} + ${body} = BuiltIn.Run Keyword If ${odl_stream_check } String.Replace String ${body} "vlan-id": 0 "vlan-id": ${vlan} + ... ELSE BuiltIn.Set Variable ${body} + ${body} = BuiltIn.Run Keyword If ${odl_stream_check } String.Replace String ${body} "gateway-ip": "0.0.0.0" "gateway-ip": "${gateway_ip}" + ... ELSE BuiltIn.Set Variable ${body} + FOR ${tool_system_index} IN RANGE ${NUM_TOOLS_SYSTEM} + ${body} String.Replace String ${body} "dpn-id": 10${tool_system_index} "dpn-id": ${DPN_ID_LIST[${tool_system_index}]} + ${body} String.Replace String ${body} "ip-address": "${tool_system_index+2}.${tool_system_index+2}.${tool_system_index+2}.${tool_system_index+2}" "ip-address": "@{tools_ips}[${tool_system_index}]" + END + BuiltIn.Log ${body} [Return] ${body} # returns complete json that has been updated -Get Dpn Ids - [Arguments] ${connection_id} - [Documentation] This keyword gets the DPN id of the switch after configuring bridges on it.It returns the captured DPN id. - Switch connection ${connection_id} - ${cmd} set Variable sudo ovs-vsctl show | grep Bridge | awk -F "\\"" '{print $2}' - ${Bridgename1} Execute command ${cmd} - log ${Bridgename1} - ${output1} Execute command sudo ovs-ofctl show -O Openflow13 ${Bridgename1} | head -1 | awk -F "dpid:" '{ print $2 }' - log ${output1} - # "echo \$\(\(16\#${output1}\)\) command below converts ovs dpnid (i.e., output1) from hexadecimal to decimal." - ${Dpn_id} Execute command echo \$\(\(16\#${output1}\)\) - log ${Dpn_id} - [Return] ${Dpn_id} - -BFD Suite Stop +Build Dpn List + [Documentation] This keyword builds the list of DPN ids after configuring OVS bridges on each of the TOOLS_SYSTEM_IPs. + @{DPN_ID_LIST} = BuiltIn.Create List + FOR ${tools_ip} IN @{TOOLS_SYSTEM_ALL_IPS} + ${output} Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl show -O Openflow13 ${Bridge} | head -1 | awk -F "dpid:" '{ print $2 }' + ${dpn_id} Utils.Run Command On Remote System And Log ${tools_ip} echo \$\(\(16\#${output}\)\) + Collections.Append To List ${DPN_ID_LIST} ${dpn_id} + END + BuiltIn.Set Suite Variable @{DPN_ID_LIST} + +BFD Suite Teardown [Documentation] Run at end of BFD suite - Delete All Vteps - Stop Suite + Genius.Delete All Vteps + Genius.Stop Suite Delete All Vteps [Documentation] This will delete vtep. - ${resp} RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/ data=${vtep_body} - Should Be Equal As Strings ${resp.status_code} 200 - Log "Before disconnecting CSS with controller" - ${output} = Issue Command On Karaf Console ${TEP_SHOW} - BuiltIn.Wait Until Keyword Succeeds 30 5 Verify All Tunnel Delete on DS + ${resp} = RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/ + BuiltIn.Should Be Equal As Strings ${resp.status_code} 200 + BuiltIn.Wait Until Keyword Succeeds 30 5 Genius.Verify Tunnel Delete on DS tun Genius Test Setup [Documentation] Genius test case setup BuiltIn.Run Keyword And Ignore Error KarafKeywords.Log_Testcase_Start_To_Controller_Karaf Genius Test Teardown - [Arguments] ${data_models} - OVSDB.Get DumpFlows And Ovsconfig ${conn_id_1} BR1 - OVSDB.Get DumpFlows And Ovsconfig ${conn_id_2} BR2 + [Arguments] ${data_models} ${test_name}=${SUITE_NAME}.${TEST_NAME} ${fail}=${FAIL_ON_EXCEPTIONS} + FOR ${tool_system_index} IN RANGE ${NUM_TOOLS_SYSTEM} + OVSDB.Get DumpFlows And Ovsconfig @{TOOLS_SYSTEM_ALL_CONN_IDS}[${tool_system_index}] ${Bridge} + END BuiltIn.Run Keyword And Ignore Error DataModels.Get Model Dump ${ODL_SYSTEM_IP} ${data_models} + KarafKeywords.Fail If Exceptions Found During Test ${test_name} fail=${fail} + ODLTools.Get All test_name=${test_name} + +Genius Suite Debugs + [Arguments] ${data_models} + Genius.Genius Test Teardown ${data_models} test_name=${SUITE_NAME} fail=False ITM Direct Tunnels Start Suite [Documentation] start suite for itm scalability ClusterManagement.ClusterManagement_Setup ClusterManagement.Stop_Members_From_List_Or_All - ClusterManagement.Clean_Journals_Data_And_Snapshots_On_List_Or_All - Run Command On Remote System And Log ${ODL_SYSTEM_IP} sed -i -- 's/false/true/g' ${GENIUS_IFM_CONFIG_FLAG} + FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM} + Utils.Run Command On Remote System And Log ${ODL_SYSTEM_${controller_index+1}_IP} sed -i -- 's/false/true/g' ${GENIUS_IFM_CONFIG_FLAG} + END ClusterManagement.Start_Members_From_List_Or_All - Genius Suite Setup + Genius.Genius Suite Setup ITM Direct Tunnels Stop Suite - Run Command On Remote System And Log ${ODL_SYSTEM_IP} sed -i -- 's/true/false/g' ${GENIUS_IFM_CONFIG_FLAG} - Genius Suite Teardown - -Verify Tunnel Monitoring is on - [Documentation] This keyword will get tep:show output and verify tunnel monitoring status - ${output}= Issue Command On Karaf Console ${TEP_SHOW} - Should Contain ${output} ${TUNNEL_MONITOR_ON} + [Documentation] Stop suite for ITM Direct Tunnels. + FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM} + Utils.Run Command On Remote System And Log ${ODL_SYSTEM_${controller_index+1}_IP} sed -i -- 's/true/false/g' ${GENIUS_IFM_CONFIG_FLAG} + END + Genius.Genius Suite Teardown -Ovs Verification For 2 Dpn - [Arguments] ${connection_id} ${local} ${remote-1} ${tunnel} ${tunnel-type} +Ovs Interface Verification [Documentation] Checks whether the created Interface is seen on OVS or not. - Switch Connection ${connection_id} - ${check} Execute Command sudo ovs-vsctl show - Log ${check} - Should Contain ${check} local_ip="${local}" remote_ip="${remote-1}" ${tunnel} ${tunnel-type} - [Return] ${check} + FOR ${tools_ip} IN @{TOOLS_SYSTEM_ALL_IPS} + Genius.Ovs Verification For Each Dpn ${tools_ip} ${TOOLS_SYSTEM_ALL_IPS} + END Get ITM - [Arguments] ${itm_created[0]} ${subnet} ${vlan} ${Dpn_id_1} ${TOOLS_SYSTEM_IP} ${Dpn_id_2} - ... ${TOOLS_SYSTEM_2_IP} + [Arguments] ${itm_created[0]} ${switch_data}=${SWITCH_DATA} [Documentation] It returns the created ITM Transport zone with the passed values during the creation is done. - Log ${itm_created[0]},${subnet}, ${vlan}, ${Dpn_id_1},${TOOLS_SYSTEM_IP}, ${Dpn_id_2}, ${TOOLS_SYSTEM_2_IP} - @{Itm-no-vlan} Create List ${itm_created[0]} ${subnet} ${vlan} ${Dpn_id_1} ${Bridge-1}-eth1 - ... ${TOOLS_SYSTEM_IP} ${Dpn_id_2} ${Bridge-2}-eth1 ${TOOLS_SYSTEM_2_IP} - Check For Elements At URI ${TUNNEL_TRANSPORTZONE}/transport-zone/${itm_created[0]} ${Itm-no-vlan} + Collections.Append To List ${switch_data} ${itm_created[0]} + Utils.Check For Elements At URI ${TUNNEL_TRANSPORTZONE}/transport-zone/${itm_created[0]} ${switch_data} Check Tunnel Delete On OVS - [Arguments] ${connection-id} ${tunnel} + [Arguments] ${tunnel_list} [Documentation] Verifies the Tunnel is deleted from OVS. - Switch Connection ${connection-id} - ${return} = Execute Command sudo ovs-vsctl show - log ${return} - Should Not Contain ${return} ${tunnel} - [Return] ${return} - -Check Table0 Entry For 2 Dpn - [Arguments] ${connection_id} ${Bridgename} ${port-num1} + FOR ${tools_ip} IN @{TOOLS_SYSTEM_ALL_IPS} + ${output} = Utils.Run Command On Remote System ${tools_ip} sudo ovs-vsctl show + Genius.Verify Deleted Tunnels on OVS ${tunnel_list} ${output} + END + +Check Table0 Entry In a Dpn + [Arguments] ${tools_ip} ${bridgename} ${port_numbers} [Documentation] Checks the Table 0 entry in the OVS when flows are dumped. - Switch Connection ${connection_id} - Log ${connection_id} - ${check} Execute Command sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridgename} - Log ${check} - Should Contain ${check} in_port=${port-num1} - [Return] ${check} - -Check ITM Tunnel State - [Arguments] ${tunnel1} ${tunnel2} - [Documentation] Verifies the Tunnel is deleted from datastore - ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/itm-state:tunnels_state/ - Should Not Contain ${resp.content} ${tunnel1} ${tunnel2} - -Verify Tunnel Status as UP - [Arguments] ${Transport_zone} + ${check} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${bridgename} + ${num_ports} = BuiltIn.Get Length ${port_numbers} + FOR ${port_index} IN RANGE ${num_ports} + BuiltIn.Should Contain ${check} in_port=@{port_numbers}[${port_index}] + END + +Verify Tunnel Status As Up + [Arguments] ${no_of_switches}=${NUM_TOOLS_SYSTEM} [Documentation] Verify that the number of tunnels are UP - ${No_of_Teps} Issue_Command_On_Karaf_Console ${TEP_SHOW} - ${Lines_of_TZA} Get Lines Containing String ${No_of_Teps} ${Transport_zone} - ${Expected_Node_Count} Get Line Count ${Lines_of_TZA} - ${no_of_tunnels} Issue_Command_On_Karaf_Console ${TEP_SHOW_STATE} - ${lines_of_VXLAN} Get Lines Containing String ${no_of_tunnels} VXLAN - Should Contain ${no_of_tunnels} ${STATE_UP} - Should Not Contain ${no_of_tunnels} ${STATE_DOWN} - Should Not Contain ${no_of_tunnels} ${STATE_UNKNOWN} - ${Actual_Tunnel_Count} Get Line Count ${lines_of_VXLAN} - ${Expected_Tunnel_Count} Set Variable ${Expected_Node_Count*${Expected_Node_Count - 1}} - Should Be Equal As Strings ${Actual_Tunnel_Count} ${Expected_Tunnel_Count} - -Check System Status - [Arguments] @{service_list} - [Documentation] This keyword will verify whether all the services are in operational and all nodes are active based on the number of odl systems - : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM} - \ Check Service Status ${ODL_SYSTEM_${i+1}_IP} ACTIVE OPERATIONAL @{service_list} + ${no_of_tunnels} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE} + ${lines_of_state_up} = String.Get Lines Containing String ${no_of_tunnels} ${STATE_UP} + ${actual_tunnel_count} = String.Get Line Count ${lines_of_state_up} + ${expected_tunnel_count} = BuiltIn.Evaluate ${no_of_switches}*(${no_of_switches}-1) + BuiltIn.Should Be Equal As Strings ${actual_tunnel_count} ${expected_tunnel_count} Verify Tunnel Status - [Arguments] ${tunnel_names} ${tunnel_status} + [Arguments] ${tunnel_status} ${tunnel_names} [Documentation] Verifies if all tunnels in the input, has the expected status(UP/DOWN/UNKNOWN) - ${tep_result} = KarafKeywords.Issue_Command_On_Karaf_Console ${TEP_SHOW_STATE} - : FOR ${tunnel} IN @{tunnel_names} - \ ${tep_output} = String.Get Lines Containing String ${tep_result} ${tunnel} - \ BuiltIn.Should Contain ${tep_output} ${tunnel_status} + ${tep_result} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE} + ${number_of_tunnels} = BuiltIn.Get Length ${tunnel_names} + FOR ${each_tunnel} IN RANGE ${number_of_tunnels} + ${tunnel} = Collections.Get From List ${tunnel_names} ${each_tunnel} + ${tep_output} = String.Get Lines Containing String ${tep_result} ${tunnel} + BuiltIn.Should Contain ${tep_output} ${tunnel_status} + END Get Tunnels On OVS [Arguments] ${connection_id} [Documentation] Retrieves the list of tunnel ports present on OVS SSHLibrary.Switch Connection ${connection_id} ${ovs_result} = Utils.Write Commands Until Expected Prompt sudo ovs-vsctl show ${DEFAULT_LINUX_PROMPT_STRICT} - ${tunnel_names} BuiltIn.Create List + @{tunnel_names} = BuiltIn.Create List ${tunnels} = String.Get Lines Matching Regexp ${ovs_result} Interface "tun.*" True @{tunnels_list} = String.Split To Lines ${tunnels} - : FOR ${tun} IN @{tunnels_list} - \ ${tun_list} BuiltIn.Should Match Regexp @{tunnels_list} tun.*\\w - \ Collections.Append To List ${tunnel_names} ${tun_list} + FOR ${tun} IN @{tunnels_list} + ${tun_list} Get Regexp Matches ${tun} tun.*\\w + Collections.Append To List ${tunnel_names} @{tun_list} + END ${items_in_list} = BuiltIn.Get Length ${tunnel_names} - [Return] ${Tunnel_Names} + [Return] @{tunnel_names} Get Tunnel - [Arguments] ${src} ${dst} ${type} + [Arguments] ${src} ${dst} ${type} ${config_api_type}=${EMPTY} [Documentation] This keyword returns tunnel interface name between source DPN and destination DPN. - ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${src}/${dst}/${type}/ + ... Statements are executed depending on whether it is itm tunnel state(default) or dpn tep state. + ${resp} = BuiltIn.Run Keyword If '${config_api_type}' == '${EMPTY}' RequestsLibrary.Get Request session ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${src}/${dst}/${type}/ + ... ELSE RequestsLibrary.Get Request session ${CONFIG_API}/itm-state:dpn-teps-state/dpns-teps/${src}/remote-dpns/${dst}/ BuiltIn.Should Be Equal As Strings ${resp.status_code} ${RESP_CODE} - BuiltIn.Should Contain ${resp.content} ${src} - BuiltIn.Should Contain ${resp.content} ${dst} + BuiltIn.Log ${resp.content} + ${respjson} = RequestsLibrary.To Json ${resp.content} pretty_print=True ${json} = Utils.Json Parse From String ${resp.content} - ${tunnel} = BuiltIn.Run Keyword If "tunnel-interface-names" in "${json}" Get Tunnel Interface Name ${json["internal-tunnel"][0]} tunnel-interface-names + BuiltIn.Should Contain ${resp.content} ${dst} + BuiltIn.Run Keyword If '${config_api_type}' == '${EMPTY}' BuiltIn.Should Contain ${resp.content} ${src} + ${tunnel_interface_name} = BuiltIn.Run Keyword If "tunnel-interface-names" in "${json}" Genius.Get Tunnel Interface Name ${json["internal-tunnel"][0]} tunnel-interface-names + ${tunnel_name_output} ${tunnel_name} = BuiltIn.Run Keyword Unless '${config_api_type}' == '${EMPTY}' BuiltIn.Should Match Regexp ${resp.content} "tunnel-name":"(tun[\\w\\d]+)" + ${tunnel} = BuiltIn.Set Variable If '${config_api_type}' == '${EMPTY}' ${tunnel_interface_name} ${tunnel_name} [Return] ${tunnel} Get Tunnel Interface Name @@ -294,10 +246,6 @@ Get Tunnel Interface Name ${tunnels} = Collections.Get From Dictionary ${json} ${expected_tunnel_interface_name} [Return] ${tunnels[0]} -Verify All Tunnel Delete on DS - [Documentation] This keyword confirms that tunnels are not present by giving command from karaf console. - Verify Tunnel Delete on DS tun - Verify Tunnel Delete on DS [Arguments] ${tunnel} [Documentation] This keyword confirms that specified tunnel is not present by giving command from karaf console. @@ -307,16 +255,92 @@ Verify Tunnel Delete on DS SRM Start Suite [Documentation] Start suite for service recovery. Genius Suite Setup - ${dpn_Id_1} = Genius.Get Dpn Ids ${conn_id_1} - ${dpn_Id_2} = Genius.Get Dpn Ids ${conn_id_2} - Genius.Create Vteps ${dpn_Id_1} ${dpn_Id_2} ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip} - ${tunnel} = BuiltIn.Wait Until Keyword Succeeds 40 20 Genius.Get Tunnel ${dpn_Id_1} ${dpn_Id_2} - ... odl-interface:tunnel-type-vxlan - BuiltIn.Wait Until Keyword Succeeds 60s 5s Genius.Verify Tunnel Status as UP TZA - Genius Test Teardown ${data_models} + Genius.Create Vteps ${NO_VLAN} ${gateway_ip} + BuiltIn.Wait Until Keyword Succeeds 60s 5s Genius.Verify Tunnel Status As Up + Genius.Genius Suite Debugs ${data_models} SRM Stop Suite [Documentation] Stop suite for service recovery. - Delete All Vteps - Genius Test Teardown ${data_models} - Genius Suite Teardown + Genius.Delete All Vteps + Genius.Genius Suite Debugs ${data_models} + Genius.Genius Suite Teardown + +Verify Tunnel Monitoring Status + [Arguments] ${tunnel_monitor_status} + ${output}= KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW} + BuiltIn.Should Contain ${output} ${tunnel_monitor_status} + +Set Switch Configuration + [Documentation] This keyword will set manager,controller,tap port,bridge on each OVS + FOR ${tool_system_index} IN RANGE ${NUM_TOOLS_SYSTEM} + SSHLibrary.Switch Connection @{TOOLS_SYSTEM_ALL_CONN_IDS}[${tool_system_index}] + SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/${SSH_KEY} any + SSHLibrary.Execute Command sudo ovs-vsctl add-br ${Bridge} + SSHLibrary.Execute Command sudo ovs-vsctl set bridge ${Bridge} protocols=OpenFlow13 + SSHLibrary.Execute Command sudo ovs-vsctl set-controller ${Bridge} tcp:${ODL_SYSTEM_IP}:${ODL_OF_PORT_6653} + SSHLibrary.Execute Command sudo ifconfig ${Bridge} up + SSHLibrary.Execute Command sudo ovs-vsctl add-port ${Bridge} tap${tool_system_index}ed70586-6c -- set Interface tap${tool_system_index}ed70586-6c type=tap + SSHLibrary.Execute Command sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT} + SSHLibrary.Execute Command sudo ovs-vsctl show + END + +Ovs Verification For Each Dpn + [Arguments] ${tools_system_ip} ${tools_ips} + [Documentation] This keyword will verify whether local and remote ip are present on the tunnels available on OVS + ${ovs_output} = Utils.Run Command On Remote System And Log ${tools_system_ip} sudo ovs-vsctl show + @{updated_tools_ip_list} = BuiltIn.Create List @{tools_ips} + Collections.Remove Values From List ${updated_tools_ip_list} ${tools_system_ip} + BuiltIn.Log Many @{updated_tools_ip_list} + ${num_tool_ips} BuiltIn.Get Length ${updated_tools_ip_list} + FOR ${num} IN RANGE ${num_tool_ips} + ${tools_ip} = Collections.Get From List ${updated_tools_ip_list} ${num} + BuiltIn.Should Contain ${ovs_output} ${tools_ip} + END + +Get Tunnels List + [Documentation] The keyword fetches the list of operational tunnels from ODL + ${no_of_tunnels} KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE} + ${tunnels} = String.Get Regexp Matches ${no_of_tunnels} tun[\\w\\d]+ + BuiltIn.Log ${tunnels} + [Return] ${tunnels} + +Verify Table0 Entry After fetching Port Number + [Documentation] This keyword will get the port number and checks the table0 entry for each dpn + FOR ${tools_ip} IN @{TOOLS_SYSTEM_ALL_IPS} + ${check} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -O OpenFlow13 show ${Bridge} + ${port_numbers} = String.Get Regexp Matches ${check} (\\d+).tun.* 1 + Genius.Check Table0 Entry In a Dpn ${tools_ip} ${Bridge} ${port_numbers} + END + +Verify Deleted Tunnels On OVS + [Arguments] ${tunnel_list} ${resp_data} + [Documentation] This will verify whether tunnel is deleted. + BuiltIn.Log ${resp_data} + FOR ${tunnel} IN @{tunnel_list} + BuiltIn.Should Not Contain ${resp_data} ${tunnel} + END + +Verify Response Code Of Dpn End Point Config API + [Arguments] ${dpn_list}=${DPN_ID_LIST} + [Documentation] This keyword will verify response code from itm-state: dpn endpoints config api for each dpn + FOR ${dpn} IN @{dpn_list} + BuiltIn.Wait Until Keyword Succeeds 40 5 Utils.Get Data From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${dpn}/ + END + +Get Tunnel Between DPNs + [Arguments] ${tunnel_type} ${config_api_type} ${src_dpn_id} @{dst_dpn_ids} + [Documentation] This keyword will Get All the Tunnels available on DPN's + FOR ${dst_dpn_id} IN @{dst_dpn_ids} + ${tunnel} = BuiltIn.Wait Until Keyword Succeeds 30 10 Genius.Get Tunnel ${src_dpn_id} + ... ${dst_dpn_id} ${tunnel_type} ${config_api_type} + END + +Update Dpn id List And Get Tunnels + [Arguments] ${tunnel_type} ${config_api_type}=${EMPTY} ${dpn_ids}=${DPN_ID_LIST} + [Documentation] Update the exisisting dpn id list to form different combination of dpn ids such that tunnel formation between all dpns is verified. + FOR ${dpn_id} IN @{dpn_ids} + @{dpn_ids_updated} = BuiltIn.Create List @{dpn_ids} + Collections.Remove Values From List ${dpn_ids_updated} ${dpn_id} + BuiltIn.Log Many ${dpn_ids_updated} + Genius.Get Tunnel Between DPNs ${tunnel_type} ${config_api_type} ${dpn_id} @{dpn_ids_updated} + END