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