Resource OVSDB.robot
Resource ../variables/netvirt/Variables.robot
Resource VpnOperations.robot
+Resource DataModels.robot
*** Variables ***
@{itm_created} TZA
${Bridge-1} BR1
${Bridge-2} BR2
${DEFAULT_MONITORING_INTERVAL} Tunnel Monitoring Interval (for VXLAN tunnels): 1000
-@{DIAG_SERVICES} OPENFLOW IFM ITM DATASTORE
+@{GENIUS_DIAG_SERVICES} OPENFLOW IFM ITM DATASTORE
+${vlan} 0
+${gateway-ip} 0.0.0.0
*** Keywords ***
Genius Suite Setup
Start Suite
[Documentation] Initial setup for Genius test suites
- Run_Keyword_If_At_Least_Oxygen Wait Until Keyword Succeeds 60 2 Check System Status
+ 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}
[Return] ${check_establishment}
Check Service Status
- [Arguments] ${odl_ip} ${system_ready_state} ${service_state}
+ [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} Issue_Command_On_Karaf_Console showSvcStatus ${odl_ip} 8101
+ ${service_status_output} = Run Keyword If ${NUM_ODL_SYSTEM}>1 Issue_Command_On_Karaf_Console showSvcStatus -n ${odl_ip} ${odl_ip} 8101
+ ... ELSE Issue_Command_On_Karaf_Console showSvcStatus ${odl_ip} 8101
Should Contain ${service_status_output} ${system_ready_state}
- : FOR ${service} IN @{DIAG_SERVICES}
+ : FOR ${service} IN @{service_list}
\ Should Match Regexp ${service_status_output} ${service} +: ${service_state}
Create Vteps
Delete All Vteps
[Documentation] This will delete vtep.
${resp} RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/ data=${vtep_body}
- Log ${resp.status_code}
Should Be Equal As Strings ${resp.status_code} 200
Log "Before disconnecting CSS with controller"
- ${output}= Issue Command On Karaf Console ${TEP_SHOW}
- Log ${output}
- ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
- Log ${output}
+ ${output} = Issue Command On Karaf Console ${TEP_SHOW}
+ BuiltIn.Wait Until Keyword Succeeds 30 5 Verify All Tunnel Delete on DS
Genius Test Teardown
[Arguments] ${data_models}
Check Tunnel Delete On OVS
[Arguments] ${connection-id} ${tunnel}
- [Documentation] Verifies the Tunnel is deleted from OVS
+ [Documentation] Verifies the Tunnel is deleted from OVS.
Switch Connection ${connection-id}
- ${return} Execute Command sudo ovs-vsctl show
- Log ${return}
+ ${return} = Execute Command sudo ovs-vsctl show
+ log ${return}
Should Not Contain ${return} ${tunnel}
[Return] ${return}
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
+ \ Check Service Status ${ODL_SYSTEM_${i+1}_IP} ACTIVE OPERATIONAL @{service_list}
+
+Verify Tunnel Status
+ [Arguments] ${tunnel_names} ${tunnel_status}
+ [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}
+
+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
+ ${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}
+ ${items_in_list} = BuiltIn.Get Length ${tunnel_names}
+ [Return] ${Tunnel_Names}
+
+Get Tunnel
+ [Arguments] ${src} ${dst} ${type}
+ [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}/
+ BuiltIn.Should Be Equal As Strings ${resp.status_code} ${RESP_CODE}
+ BuiltIn.Should Contain ${resp.content} ${src}
+ BuiltIn.Should Contain ${resp.content} ${dst}
+ ${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
+ [Return] ${tunnel}
+
+Get Tunnel Interface Name
+ [Arguments] ${json} ${expected_tunnel_interface_name}
+ [Documentation] This keyword extracts tunnel interface name from json given as input.
+ ${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.
+ ${output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE}
+ BuiltIn.Should Not Contain ${output} ${tunnel}
+
+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
+
+SRM Stop Suite
+ [Documentation] Stop suite for service recovery.
+ Delete All Vteps
+ Genius Suite Teardown