GENIUS-157: CSIT Test suite for OF-Tunnels Phase-1
[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     : FOR    ${node_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
41     \    ${ip} =    OvsManager.Get OVS Local Ip    ${node_ip}
42     \    Collections.Append To List    ${LOCAL_IPS}    ${ip}
43     BuiltIn.Set Suite Variable    @{LOCAL_IPS}
44     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
45
46 Verify TEPs with transport zone configured from OVS will be added to corresponding transport zone
47     [Documentation]    To Verify transport zone name change in external id field of ovsdb and check status when moved from tep nohosted zone to TZA
48     Change Transport Zone In Compute    ${TOOLS_SYSTEM_1_IP}    ${TRANSPORT_ZONE}
49     ${get_nohosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TEP_NOT_HOSTED_ZONE_URL}
50     BuiltIn.Should Contain    ${get_nohosted_data}    ${TRANSPORT_ZONE}
51     BuiltIn.Should Contain    ${get_nohosted_data}    @{DPN_ID_LIST}[0]
52     Utils.Post Elements To URI From File    ${TRANSPORTZONE_POST_URL}    ${TZA_JSON}
53     : FOR    ${node_number}    IN RANGE    2    ${NUM_TOOLS_SYSTEM}+1
54     \    Change Transport Zone In Compute    ${TOOLS_SYSTEM_${node_number}_IP}    ${TRANSPORT_ZONE}
55     : FOR    ${node}    IN    @{TOOLS_SYSTEM_ALL_IPS}
56     \    ${output} =    Utils.Run Command On Remote System    ${node}    ${GET_EXTERNAL_IDS}
57     \    BuiltIn.Should Contain    ${output}    ${TRANSPORT_ZONE}
58     ${get_hosted_data} =    BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Utils.Get Data From URI    session    ${TRANSPORT_ZONE_ENDPOINT_URL}/${TRANSPORT_ZONE}
59     BuiltIn.Should Contain    ${get_hosted_data}    ${TRANSPORT_ZONE}
60     BuiltIn.Should Contain    ${get_hosted_data}    @{DPN_ID_LIST}[0]
61     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
62
63 Verify other-config-key and transport zone value in controller operational datastore
64     [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
65     ${controller-data} =    Utils.Get Data From URI    session    ${GET_NETWORK_TOPOLOGY_URL}
66     : FOR    ${node_ip}    IN    @{LOCAL_IPS}
67     \    BuiltIn.Should Contain    ${controller-data}    "other-config-value":"${node_ip}"
68     BuiltIn.Should Contain    ${controller-data}    "external-id-value":"${TRANSPORT_ZONE}"
69
70 Delete transport zone on OVS and check ovsdb update to controller
71     [Documentation]    To verify transport zone moves to default zone after deleting zone name in compute nodes
72     : FOR    ${node}    IN    @{TOOLS_SYSTEM_ALL_IPS}
73     \    Utils.Run Command On Remote System    ${node}    ${DELETE_TRANSPORT_ZONE}
74     ${tep_show_output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
75     BuiltIn.Should Contain    ${tep_show_output}    ${DEFAULT_TRANSPORT_ZONE}
76     BuiltIn.Wait Until Keyword Succeeds    3x    10 sec    Genius.Verify Tunnel Status as Up
77     VpnOperations.ITM Delete Tunnel    ${TRANSPORT_ZONE}
78
79 *** Keywords ***
80 Change Transport Zone In Compute
81     [Arguments]    ${compute_ip}    ${zone_name}
82     [Documentation]    Change transport zone in Compute and verify its configuration
83     Utils.Run Command On Remote System    ${compute_ip}    ${CHANGE_TRANSPORT_ZONE}=${zone_name}
84     ${output} =    Utils.Run Command On Remote System    ${compute_ip}    ${GET_EXTERNAL_IDS}
85     BuiltIn.Should Contain    ${output}    ${zone_name}