Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / genius / ITM_Vtep_Auto_Tunnel.robot
1 *** Settings ***
2 Documentation     Test suite to validate ITM VTEP auto-configuration functionality in openstack integrated environment.
3 Suite Setup       BuiltIn.Run Keywords    Genius.Genius Suite Setup
4 ...               AND    OvsManager.Verify Ovs Version Greater Than Or Equal To    ${OVS_VERSION}    @{TOOLS_SYSTEM_ALL_IPS}
5 Suite Teardown    Genius.Genius Suite Teardown
6 Test Setup        Genius Test Setup
7 Test Teardown     Genius Test Teardown    ${data_models}
8 Library           OperatingSystem
9 Library           RequestsLibrary
10 Library           SSHLibrary
11 Library           String
12 Resource          ../../libraries/Genius.robot
13 Resource          ../../libraries/KarafKeywords.robot
14 Resource          ../../libraries/OVSDB.robot
15 Resource          ../../libraries/OvsManager.robot
16 Resource          ../../libraries/Utils.robot
17 Resource          ../../libraries/VpnOperations.robot
18 Resource          ../../variables/netvirt/Variables.robot
19 Resource          ../../variables/Variables.robot
20 Variables         ../../variables/genius/Modules.py
21
22 *** Variables ***
23 ${CHANGE_TRANSPORT_ZONE}    sudo ovs-vsctl set O . external_ids:transport-zone
24 ${TZA_JSON}       ${GENIUS_VAR_DIR}/Itm_Auto_Tunnel_Create.json
25 ${DELETE_TRANSPORT_ZONE}    sudo ovs-vsctl remove O . external_ids transport-zone
26 ${GET_EXTERNAL_IDS}    sudo ovsdb-client dump -f list Open_vSwitch | grep external_ids
27 ${GET_NETWORK_TOPOLOGY_URL}    ${OPERATIONAL_API}/network-topology:network-topology/topology/ovsdb:1/
28 ${OVS_VERSION}    2.5
29 ${SHOW_OTHER_CONFIG}    sudo ovsdb-client dump -f list Open_vSwitch | grep other_config
30 ${STATUS_CHECK}    DOWN
31 ${TRANSPORT_ZONE}    TZA
32 ${TRANSPORTZONE_POST_URL}    ${CONFIG_API}/itm:transport-zones
33
34 *** Test Cases ***
35 Verify TEP in controller and transport zone in OVSDB table of compute nodes
36     [Documentation]    Set local ip in compute nodes and verify default transport zone tunnels are up in controller
37     @{LOCAL_IPS} =    BuiltIn.Create List
38     FOR    ${ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
39         ${localip} =    Utils.Run Command On Remote System    ${ip}    ${SET_LOCAL_IP}${ip}
40     END
41     FOR    ${node_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
42         ${ip} =    OvsManager.Get OVS Local Ip    ${node_ip}
43         Collections.Append To List    ${LOCAL_IPS}    ${ip}
44     END
45     BuiltIn.Set Suite Variable    @{LOCAL_IPS}
46     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
47
48 Verify TEPs with transport zone configured from OVS will be added to corresponding transport zone
49     [Documentation]    To Verify transport zone name change in external id field of ovsdb and check status when moved from tep nohosted zone to TZA
50     Change Transport Zone In Compute    ${TOOLS_SYSTEM_1_IP}    ${TRANSPORT_ZONE}
51     ${get_nohosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TEP_NOT_HOSTED_ZONE_URL}
52     BuiltIn.Should Contain    ${get_nohosted_data}    ${TRANSPORT_ZONE}
53     BuiltIn.Should Contain    ${get_nohosted_data}    @{DPN_ID_LIST}[0]
54     Utils.Post Elements To URI From File    ${TRANSPORTZONE_POST_URL}    ${TZA_JSON}
55     FOR    ${node_number}    IN RANGE    2    ${NUM_TOOLS_SYSTEM}+1
56         Change Transport Zone In Compute    ${TOOLS_SYSTEM_${node_number}_IP}    ${TRANSPORT_ZONE}
57     END
58     FOR    ${node}    IN    @{TOOLS_SYSTEM_ALL_IPS}
59         ${output} =    Utils.Run Command On Remote System    ${node}    ${GET_EXTERNAL_IDS}
60         BuiltIn.Should Contain    ${output}    ${TRANSPORT_ZONE}
61     END
62     ${get_hosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TRANSPORT_ZONE_ENDPOINT_URL}/${TRANSPORT_ZONE}
63     BuiltIn.Should Contain    ${get_hosted_data}    ${TRANSPORT_ZONE}
64     BuiltIn.Should Contain    ${get_hosted_data}    @{DPN_ID_LIST}[0]
65     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
66
67 Verify other-config-key and transport zone value in controller operational datastore
68     [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
69     ${controller-data} =    Utils.Get Data From URI    session    ${GET_NETWORK_TOPOLOGY_URL}
70     FOR    ${node_ip}    IN    @{LOCAL_IPS}
71         BuiltIn.Should Contain    ${controller-data}    "other-config-value":"${node_ip}"
72     END
73     BuiltIn.Should Contain    ${controller-data}    "external-id-value":"${TRANSPORT_ZONE}"
74
75 Delete transport zone on OVS and check ovsdb update to controller
76     [Documentation]    To verify transport zone moves to default zone after deleting zone name in compute nodes
77     FOR    ${node}    IN    @{TOOLS_SYSTEM_ALL_IPS}
78         Utils.Run Command On Remote System    ${node}    ${DELETE_TRANSPORT_ZONE}
79     END
80     ${tep_show_output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
81     BuiltIn.Should Contain    ${tep_show_output}    ${DEFAULT_TRANSPORT_ZONE}
82     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
83     VpnOperations.ITM Delete Tunnel    ${TRANSPORT_ZONE}
84
85 *** Keywords ***
86 Change Transport Zone In Compute
87     [Arguments]    ${compute_ip}    ${zone_name}
88     [Documentation]    Change transport zone in Compute and verify its configuration
89     Utils.Run Command On Remote System    ${compute_ip}    ${CHANGE_TRANSPORT_ZONE}=${zone_name}
90     ${output} =    Utils.Run Command On Remote System    ${compute_ip}    ${GET_EXTERNAL_IDS}
91     BuiltIn.Should Contain    ${output}    ${zone_name}