Qualify Keywords in Genius Suite
[integration/test.git] / csit / suites / genius / Configure_ITM.robot
1 *** Settings ***
2 Documentation     Test Suite for ITM
3 Suite Setup       Genius Suite Setup
4 Suite Teardown    Genius Suite Teardown
5 Test Setup        Genius Test Setup
6 Test Teardown     Genius Test Teardown    ${data_models}
7 Library           Collections
8 Library           OperatingSystem
9 Library           RequestsLibrary
10 Library           String
11 Resource          ../../libraries/DataModels.robot
12 Resource          ../../libraries/Genius.robot
13 Resource          ../../libraries/KarafKeywords.robot
14 Resource          ../../libraries/ToolsSystem.robot
15 Resource          ../../libraries/Utils.robot
16 Resource          ../../variables/netvirt/Variables.robot
17 Resource          ../../variables/Variables.robot
18 Variables         ../../variables/genius/Modules.py
19
20 *** Variables ***
21 ${gateway_regex_IPV4}    [0-9]\{1,3}\.[0-9]\{1,3}\.[0-9]\{1,3}\.
22 ${gateway_regex_IPV6}    [0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:
23
24 *** Test Cases ***
25 Create and Verify VTEP -No Vlan
26     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs without VLAN and Gateway configured in Json.
27     Genius.Create Vteps    ${NO_VLAN}    ${gateway_ip}
28     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Get ITM    ${itm_created[0]}    ${SUBNET}    ${NO_VLAN}
29     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
30     Genius.Update Dpn id list and get tunnels    ${type}
31     Genius.Verify Response Code Of Dpn Endpointconfig API
32     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Ovs Interface Verification
33     BuiltIn.Wait Until Keyword Succeeds    60    5    Genius.Verify Tunnel Status As Up
34     Verify Network Topology
35     Verify Ietf Interface State
36     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Table0 Entry After fetching Port Number
37     ${resp} =    RequestsLibrary.Get Request    session    ${OPERATIONAL_NODES_API}
38     ${respjson} =    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
39     BuiltIn.Log    ${respjson}
40     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
41
42 Delete and Verify VTEP -No Vlan
43     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
44     ${tunnel_list} =    Genius.Get Tunnels List
45     : FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
46     \    Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET}%2F16/vteps/${dpn_id}/${port_name}
47     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
48     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
49     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
50     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
51     BuiltIn.Should Not Contain    ${resp} =    ${itm_created[0]}
52     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Deleted Tunnels On OVS    ${tunnel_list}    ${resp}
53     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
54
55 Create and Verify VTEP IPv6 - No Vlan
56     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs without VLAN and Gateway configured in Json.
57     ${gateway_ip} =    BuiltIn.Set Variable    ::
58     Build Tools System IPV6 List
59     Create Vteps IPv6    ${NO_VLAN}    ${gateway_ip}    ${TOOLS_SYSTEM_IPV6_LIST}
60     BuiltIn.Wait Until Keyword Succeeds    40    10    Get ITM IPV6    ${itm_created[0]}    ${SUBNET_IPV6}    ${NO_VLAN}
61     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
62     Genius.Update Dpn id list and get tunnels    ${type}
63     : FOR    ${dpn}    IN    @{DPN_ID_LIST}
64     \    BuiltIn.Wait Until Keyword Succeeds    40    5    Utils.Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${dpn}/
65     \    ...    headers=${ACCEPT_XML}
66     BuiltIn.Wait Until Keyword Succeeds    40    10    OVS Verification Between IPV6
67     @{all_tunnels} =    BuiltIn.Create List
68     : FOR    ${conn_id}    IN    @{TOOLS_SYSTEM_ALL_CONN_IDS}
69     \    ${tun_names} =    Genius.Get Tunnels On OVS    ${conn_id}
70     \    Collections.Append To List    ${all_tunnels}    @{tun_names}
71     @{network_topology_list} =    BuiltIn.Create List    @{all_tunnels}
72     @{network_topology_list} =    Collections.Append To List    ${network_topology_list}    ${Bridge}
73     ${resp} =    BuiltIn.Wait Until Keyword Succeeds    40    10    Get Network Topology with Tunnel    ${OPERATIONAL_TOPO_API}    ${network_topology_list}
74
75 Delete and Verify VTEP IPv6 -No Vlan
76     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
77     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
78     ${tunnel_list} =    Genius.Get Tunnels List
79     : FOR    ${dpn}    IN    @{DPN_ID_LIST}
80     \    Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET_IPV6}%2F16/vteps/${dpn}/${port_name}
81     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
82     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
83     BuiltIn.Run Keyword And Ignore Error    Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
84     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
85     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
86     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Deleted Tunnels On OVS    ${tunnel_list}    ${resp}
87     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
88
89 Create and Verify VTEP-Vlan
90     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and without Gateway configured in Json.
91     Genius.Create Vteps    ${VLAN}    ${gateway_ip}
92     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Get ITM    ${itm_created[0]}    ${SUBNET}    ${VLAN}
93     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
94     Genius.Update Dpn id list and get tunnels    ${type}
95     Genius.Verify Response Code Of Dpn Endpointconfig API
96     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Ovs Interface Verification
97     Verify Network Topology
98     Verify Ietf Interface State
99     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Table0 Entry After fetching Port Number
100
101 Delete and Verify VTEP -Vlan
102     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
103     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
104     ${tunnel_list} =    Genius.Get Tunnels List
105     : FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
106     \    Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET}%2F16/vteps/${dpn_id}/${port_name}
107     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
108     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
109     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
110     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
111     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
112     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Deleted Tunnels On OVS    ${tunnel_list}    ${resp}
113     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
114
115 Create VTEP - Vlan and Gateway
116     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and Gateway configured in Json.
117     ${substr} =    BuiltIn.Should Match Regexp    ${TOOLS_SYSTEM_IP}    ${gateway_regex_IPV4}
118     ${gateway_ip} =    BuiltIn.Catenate    ${substr}1
119     Genius.Create Vteps    ${VLAN}    ${gateway_ip}
120     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Get ITM    ${itm_created[0]}    ${SUBNET}    ${VLAN}
121     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
122     Genius.Update Dpn id list and get tunnels    ${type}
123     ${tunnel-type} =    BuiltIn.Set Variable    type: vxlan
124     Genius.Verify Response Code Of Dpn Endpointconfig API
125     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Ovs Interface Verification
126     BuiltIn.Wait Until Keyword Succeeds    60    5    Genius.Verify Tunnel Status As Up
127     Verify Network Topology
128     Verify Ietf Interface State
129     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Table0 Entry After fetching Port Number
130
131 Delete VTEP -Vlan and gateway
132     [Documentation]    This testcase deletes the ITM tunnel created between 2 dpns.
133     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
134     ${tunnel_list} =    Genius.Get Tunnels List
135     : FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
136     \    Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET}%2F16/vteps/${dpn_id}/${port_name}
137     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
138     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
139     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
140     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
141     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
142     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Deleted Tunnels On OVS    ${tunnel_list}    ${resp}
143     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
144
145 *** Keywords ***
146 Create Vteps IPv6
147     [Arguments]    ${vlan}    ${gateway_ip}    ${tools_ips}
148     [Documentation]    This keyword creates VTEPs between IPV6 ip's
149     ${body} =    OperatingSystem.Get File    ${genius_config_dir}/Itm_creation_no_vlan.json
150     ${substr} =    BuiltIn.Should Match Regexp    @{tools_ips}[0]    ${gateway_regex_IPV6}
151     ${SUBNET_IPV6} =    BuiltIn.Catenate    ${substr}0
152     BuiltIn.Set Suite Variable    ${SUBNET_IPV6}
153     ${body} =    Genius.Set Json    ${vlan}    ${gateway_ip}    ${SUBNET_IPV6}    @{TOOLS_SYSTEM_IPV6_LIST}
154     Utils.Post Log Check    ${CONFIG_API}/itm:transport-zones/    ${body}    204
155
156 Get Network Topology with Tunnel
157     [Arguments]    ${url}    ${network_topology_list}
158     [Documentation]    Returns the Network topology with Tunnel info in it.
159     Utils.Check For Elements At URI    ${url}    ${network_topology_list}
160
161 Get ITM IPV6
162     [Arguments]    ${itm_created[0]}    ${subnet}    ${vlan}
163     [Documentation]    It returns the created ITM Transport zone with the passed values during the creation is done.
164     @{Itm-no-vlan} =    BuiltIn.Create List    ${itm_created[0]}    ${subnet}    ${vlan}    ${Bridge}
165     @{Itm-no-vlan} =    Collections.Combine Lists    ${Itm-no-vlan}    ${TOOLS_SYSTEM_IPV6_LIST}    ${DPN_ID_LIST}
166     BuiltIn.Log Many    @{Itm-no-vlan}
167     Utils.Check For Elements At URI    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}    ${Itm-no-vlan}
168
169 OVS Verification Between IPV6
170     [Documentation]    This keyword will verify tunnels available on ovs
171     : FOR    ${tools_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
172     \    Genius.Ovs Verification For Each Dpn    ${tools_ip}    ${TOOLS_SYSTEM_IPV6_LIST}
173
174 Verify Network Topology
175     [Documentation]    This keyword will verify whether all tunnels and bridges are populated in network topology
176     ${all_tunnels} =    Genius.Get Tunnels List
177     @{network_topology_list} =    BuiltIn.Create List
178     @{network_topology_list} =    Collections.Append To List    ${network_topology_list}    ${Bridge}
179     @{network_topology_list} =    Collections.Combine Lists    ${network_topology_list}    ${all_tunnels}
180     ${resp} =    BuiltIn.Wait Until Keyword Succeeds    40    10    Get Network Topology with Tunnel    ${OPERATIONAL_TOPO_API}    ${network_topology_list}
181
182 Verify Ietf Interface State
183     Utils.Check For Elements At URI    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/    ${DPN_ID_LIST}    session    True
184     ${all_tunnels} =    Genius.Get Tunnels List
185     Utils.Check For Elements At URI    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/    ${all_tunnels}    session    True
186
187 Build Tools System IPV6 List
188     [Documentation]    Create a list of tools system ips with IPV6.
189     @{TOOLS_SYSTEM_IPV6_LIST} =    BuiltIn.Create List
190     : FOR    ${tool_system_index}    IN RANGE    ${NUM_TOOLS_SYSTEM}
191     \    Collections.Append To List    ${TOOLS_SYSTEM_IPV6_LIST}    fd96:2a25:4ad3:3c7d:0:0:${tool_system_index}:1000
192     BuiltIn.Set Suite Variable    @{TOOLS_SYSTEM_IPV6_LIST}