INTTEST-91 - Updating list and dictionary syntax
[integration/test.git] / csit / suites / genius / ITM_Vtep_Auto_Tunnel.robot
index d88abb993802b917a36a8a7b6fa1623f8e81b637..62c12e87deea817fef5515fe6c619b447d820f30 100644 (file)
@@ -1,7 +1,7 @@
 *** Settings ***
 Documentation     Test suite to validate ITM VTEP auto-configuration functionality in openstack integrated environment.
 Suite Setup       BuiltIn.Run Keywords    Genius.Genius Suite Setup
-...               AND    OvsManager.Verify Ovs Version Greater Than Or Equal To    ${OVS_VERSION}    @{COMPUTE-NODE-LIST}
+...               AND    OvsManager.Verify Ovs Version Greater Than Or Equal To    ${OVS_VERSION}    @{TOOLS_SYSTEM_ALL_IPS}
 Suite Teardown    Genius.Genius Suite Teardown
 Test Setup        Genius Test Setup
 Test Teardown     Genius Test Teardown    ${data_models}
@@ -21,67 +21,65 @@ Variables         ../../variables/genius/Modules.py
 
 *** Variables ***
 ${CHANGE_TRANSPORT_ZONE}    sudo ovs-vsctl set O . external_ids:transport-zone
-${SET_LOCAL_IP}    sudo ovs-vsctl set O . other_config:local_ip=
 ${TZA_JSON}       ${GENIUS_VAR_DIR}/Itm_Auto_Tunnel_Create.json
-${DEFAULT_TRANSPORT_ZONE}    default-transport-zone
 ${DELETE_TRANSPORT_ZONE}    sudo ovs-vsctl remove O . external_ids transport-zone
 ${GET_EXTERNAL_IDS}    sudo ovsdb-client dump -f list Open_vSwitch | grep external_ids
 ${GET_NETWORK_TOPOLOGY_URL}    ${OPERATIONAL_API}/network-topology:network-topology/topology/ovsdb:1/
 ${OVS_VERSION}    2.5
-${REMOVE_LOCAL_IP}    sudo ovs-vsctl remove O . other_config local_ip
 ${SHOW_OTHER_CONFIG}    sudo ovsdb-client dump -f list Open_vSwitch | grep other_config
 ${STATUS_CHECK}    DOWN
 ${TRANSPORT_ZONE}    TZA
 ${TRANSPORTZONE_POST_URL}    ${CONFIG_API}/itm:transport-zones
-@{COMPUTE-NODE-LIST}    ${TOOLS_SYSTEM_1_IP}    ${TOOLS_SYSTEM_2_IP}
 
 *** Test Cases ***
 Verify TEP in controller and transport zone in OVSDB table of compute nodes
     [Documentation]    Set local ip in compute nodes and verify default transport zone tunnels are up in controller
-    : FOR    ${ip}    IN    @{COMPUTE-NODE-LIST}
-    \    ${localip} =    Utils.Run Command On Remote System    ${ip}    ${SET_LOCAL_IP}${ip}
-    ${dpn} =    OVSDB.Get DPID    ${TOOLS_SYSTEM_1_IP}
-    ${dpn} =    BuiltIn.Convert To String    ${dpn}
-    BuiltIn.Set Suite Variable    ${DPN1}    ${dpn}
-    ${dpn} =    OVSDB.Get DPID    ${TOOLS_SYSTEM_2_IP}
-    ${dpn} =    BuiltIn.Convert To String    ${dpn}
-    BuiltIn.Set Suite Variable    ${DPN2}    ${dpn}
-    ${ip} =    OvsManager.Get OVS Local Ip    ${TOOLS_SYSTEM_1_IP}
-    BuiltIn.Set Suite Variable    ${LOCAL_IP_COMPUTE1}    ${ip}
-    ${ip} =    OvsManager.Get OVS Local Ip    ${TOOLS_SYSTEM_2_IP}
-    BuiltIn.Set Suite Variable    ${LOCAL_IP_COMPUTE2}    ${ip}
-    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as UP    ${DEFAULT_TRANSPORT_ZONE}
+    @{LOCAL_IPS} =    BuiltIn.Create List
+    FOR    ${ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
+        ${localip} =    Utils.Run Command On Remote System    ${ip}    ${SET_LOCAL_IP}${ip}
+    END
+    FOR    ${node_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
+        ${ip} =    OvsManager.Get OVS Local Ip    ${node_ip}
+        Collections.Append To List    ${LOCAL_IPS}    ${ip}
+    END
+    BuiltIn.Set Suite Variable    @{LOCAL_IPS}
+    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
 
 Verify TEPs with transport zone configured from OVS will be added to corresponding transport zone
     [Documentation]    To Verify transport zone name change in external id field of ovsdb and check status when moved from tep nohosted zone to TZA
     Change Transport Zone In Compute    ${TOOLS_SYSTEM_1_IP}    ${TRANSPORT_ZONE}
     ${get_nohosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TEP_NOT_HOSTED_ZONE_URL}
     BuiltIn.Should Contain    ${get_nohosted_data}    ${TRANSPORT_ZONE}
-    BuiltIn.Should Contain    ${get_nohosted_data}    ${DPN1}
+    BuiltIn.Should Contain    ${get_nohosted_data}    ${DPN_ID_LIST}[0]
     Utils.Post Elements To URI From File    ${TRANSPORTZONE_POST_URL}    ${TZA_JSON}
-    Change Transport Zone In Compute    ${TOOLS_SYSTEM_2_IP}    ${TRANSPORT_ZONE}
-    : FOR    ${node}    IN    @{COMPUTE-NODE-LIST}
-    \    ${output} =    Utils.Run Command On Remote System    ${node}    ${GET_EXTERNAL_IDS}
-    \    BuiltIn.Should Contain    ${output}    ${TRANSPORT_ZONE}
+    FOR    ${node_number}    IN RANGE    2    ${NUM_TOOLS_SYSTEM}+1
+        Change Transport Zone In Compute    ${TOOLS_SYSTEM_${node_number}_IP}    ${TRANSPORT_ZONE}
+    END
+    FOR    ${node}    IN    @{TOOLS_SYSTEM_ALL_IPS}
+        ${output} =    Utils.Run Command On Remote System    ${node}    ${GET_EXTERNAL_IDS}
+        BuiltIn.Should Contain    ${output}    ${TRANSPORT_ZONE}
+    END
     ${get_hosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TRANSPORT_ZONE_ENDPOINT_URL}/${TRANSPORT_ZONE}
     BuiltIn.Should Contain    ${get_hosted_data}    ${TRANSPORT_ZONE}
-    BuiltIn.Should Contain    ${get_hosted_data}    ${DPN1}
-    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as UP    ${TRANSPORT_ZONE}
+    BuiltIn.Should Contain    ${get_hosted_data}    ${DPN_ID_LIST}[0]
+    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
 
 Verify other-config-key and transport zone value in controller operational datastore
     [Documentation]    validate local_ip and transport-zone value from controller datastore and Verify value of external-id-key with transport_zone in Controller operational datastore
     ${controller-data} =    Utils.Get Data From URI    session    ${GET_NETWORK_TOPOLOGY_URL}
-    BuiltIn.Should Contain    ${controller-data}    "other-config-value":"${LOCAL_IP_COMPUTE1}"
-    BuiltIn.Should Contain    ${controller-data}    "other-config-value":"${LOCAL_IP_COMPUTE2}"
+    FOR    ${node_ip}    IN    @{LOCAL_IPS}
+        BuiltIn.Should Contain    ${controller-data}    "other-config-value":"${node_ip}"
+    END
     BuiltIn.Should Contain    ${controller-data}    "external-id-value":"${TRANSPORT_ZONE}"
 
 Delete transport zone on OVS and check ovsdb update to controller
     [Documentation]    To verify transport zone moves to default zone after deleting zone name in compute nodes
-    : FOR    ${node}    IN    @{COMPUTE-NODE-LIST}
-    \    Utils.Run Command On Remote System    ${node}    ${DELETE_TRANSPORT_ZONE}
+    FOR    ${node}    IN    @{TOOLS_SYSTEM_ALL_IPS}
+        Utils.Run Command On Remote System    ${node}    ${DELETE_TRANSPORT_ZONE}
+    END
     ${tep_show_output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
     BuiltIn.Should Contain    ${tep_show_output}    ${DEFAULT_TRANSPORT_ZONE}
-    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as UP    ${DEFAULT_TRANSPORT_ZONE}
+    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
     VpnOperations.ITM Delete Tunnel    ${TRANSPORT_ZONE}
 
 *** Keywords ***