Add ping test in aclrecovery suite
[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 ${SET_LOCAL_IP}    sudo ovs-vsctl set O . other_config:local_ip=
25 ${TZA_JSON}       ${GENIUS_VAR_DIR}/Itm_Auto_Tunnel_Create.json
26 ${DEFAULT_TRANSPORT_ZONE}    default-transport-zone
27 ${DELETE_TRANSPORT_ZONE}    sudo ovs-vsctl remove O . external_ids transport-zone
28 ${GET_EXTERNAL_IDS}    sudo ovsdb-client dump -f list Open_vSwitch | grep external_ids
29 ${GET_NETWORK_TOPOLOGY_URL}    ${OPERATIONAL_API}/network-topology:network-topology/topology/ovsdb:1/
30 ${OVS_VERSION}    2.5
31 ${REMOVE_LOCAL_IP}    sudo ovs-vsctl remove O . other_config local_ip
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 *** Test Cases ***
38 Verify TEP in controller and transport zone in OVSDB table of compute nodes
39     [Documentation]    Set local ip in compute nodes and verify default transport zone tunnels are up in controller
40     @{LOCAL_IPS} =    BuiltIn.Create List
41     : FOR    ${ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
42     \    ${localip} =    Utils.Run Command On Remote System    ${ip}    ${SET_LOCAL_IP}${ip}
43     : FOR    ${node_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
44     \    ${ip} =    OvsManager.Get OVS Local Ip    ${node_ip}
45     \    Collections.Append To List    ${LOCAL_IPS}    ${ip}
46     BuiltIn.Set Suite Variable    @{LOCAL_IPS}
47     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
48
49 Verify TEPs with transport zone configured from OVS will be added to corresponding transport zone
50     [Documentation]    To Verify transport zone name change in external id field of ovsdb and check status when moved from tep nohosted zone to TZA
51     Change Transport Zone In Compute    ${TOOLS_SYSTEM_1_IP}    ${TRANSPORT_ZONE}
52     ${get_nohosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TEP_NOT_HOSTED_ZONE_URL}
53     BuiltIn.Should Contain    ${get_nohosted_data}    ${TRANSPORT_ZONE}
54     BuiltIn.Should Contain    ${get_nohosted_data}    @{DPN_ID_LIST}[0]
55     Utils.Post Elements To URI From File    ${TRANSPORTZONE_POST_URL}    ${TZA_JSON}
56     : FOR    ${node_number}    IN RANGE    2    ${NUM_TOOLS_SYSTEM}+1
57     \    Change Transport Zone In Compute    ${TOOLS_SYSTEM_${node_number}_IP}    ${TRANSPORT_ZONE}
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     ${get_hosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TRANSPORT_ZONE_ENDPOINT_URL}/${TRANSPORT_ZONE}
62     BuiltIn.Should Contain    ${get_hosted_data}    ${TRANSPORT_ZONE}
63     BuiltIn.Should Contain    ${get_hosted_data}    @{DPN_ID_LIST}[0]
64     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
65
66 Verify other-config-key and transport zone value in controller operational datastore
67     [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
68     ${controller-data} =    Utils.Get Data From URI    session    ${GET_NETWORK_TOPOLOGY_URL}
69     : FOR    ${node_ip}    IN    @{LOCAL_IPS}
70     \    BuiltIn.Should Contain    ${controller-data}    "other-config-value":"${node_ip}"
71     BuiltIn.Should Contain    ${controller-data}    "external-id-value":"${TRANSPORT_ZONE}"
72
73 Delete transport zone on OVS and check ovsdb update to controller
74     [Documentation]    To verify transport zone moves to default zone after deleting zone name in compute nodes
75     : FOR    ${node}    IN    @{TOOLS_SYSTEM_ALL_IPS}
76     \    Utils.Run Command On Remote System    ${node}    ${DELETE_TRANSPORT_ZONE}
77     ${tep_show_output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
78     BuiltIn.Should Contain    ${tep_show_output}    ${DEFAULT_TRANSPORT_ZONE}
79     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
80     VpnOperations.ITM Delete Tunnel    ${TRANSPORT_ZONE}
81
82 *** Keywords ***
83 Change Transport Zone In Compute
84     [Arguments]    ${compute_ip}    ${zone_name}
85     [Documentation]    Change transport zone in Compute and verify its configuration
86     Utils.Run Command On Remote System    ${compute_ip}    ${CHANGE_TRANSPORT_ZONE}=${zone_name}
87     ${output} =    Utils.Run Command On Remote System    ${compute_ip}    ${GET_EXTERNAL_IDS}
88     BuiltIn.Should Contain    ${output}    ${zone_name}