7bcda49b3d6ce1e8c1396b1e151842c9e5d7fbb8
[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 Teardown     Genius Test Teardown    ${data_models}
6 Library           Collections
7 Library           OperatingSystem
8 Library           RequestsLibrary
9 Library           String
10 Library           re
11 Variables         ../../variables/genius/Modules.py
12 Resource          ../../libraries/DataModels.robot
13 Resource          ../../libraries/Genius.robot
14 Resource          ../../libraries/Utils.robot
15 Resource          ../../variables/Variables.robot
16
17 *** Variables ***
18 @{itm_created}    TZA
19 ${genius_config_dir}    ${CURDIR}/../../variables/genius
20 ${Bridge-1}       BR1
21 ${Bridge-2}       BR2
22
23 *** Test Cases ***
24 Create and Verify VTEP -No Vlan
25     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs without VLAN and Gateway configured in Json.
26     ${Dpn_id_1}    Genius.Get Dpn Ids    ${conn_id_1}
27     ${Dpn_id_2}    Genius.Get Dpn Ids    ${conn_id_2}
28     ${vlan}=    Set Variable    0
29     ${gateway-ip}=    Set Variable    0.0.0.0
30     Genius.Create Vteps    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
31     Wait Until Keyword Succeeds    40    10    Get ITM    ${itm_created[0]}    ${subnet}    ${vlan}
32     ...    ${Dpn_id_1}    ${TOOLS_SYSTEM_IP}    ${Dpn_id_2}    ${TOOLS_SYSTEM_2_IP}
33     ${type}    set variable    odl-interface:tunnel-type-vxlan
34     ${tunnel-1}    Wait Until Keyword Succeeds    40    20    Get Tunnel    ${Dpn_id_1}    ${Dpn_id_2}
35     ...    ${type}
36     Set Global Variable    ${tunnel-1}
37     ${tunnel-2}    Wait Until Keyword Succeeds    40    20    Get Tunnel    ${Dpn_id_2}    ${Dpn_id_1}
38     ...    ${type}
39     Set Global Variable    ${tunnel-2}
40     ${tunnel-type}=    Set Variable    type: vxlan
41     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/
42     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/
43     Log    >>>>OVS Validation in Switch 1 for Tunnel Created<<<<<
44     Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_1}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}
45     ...    ${tunnel-1}    ${tunnel-type}
46     Log    >>>>OVS Validation in Switch 2 for Tunnel Created<<<<<
47     Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_2}    ${TOOLS_SYSTEM_2_IP}    ${TOOLS_SYSTEM_IP}
48     ...    ${tunnel-2}    ${tunnel-type}
49     Log    >>>> Getting Network Topology Operational <<<<<<
50     ${resp}    Wait Until Keyword Succeeds    40    10    Get Network Topology with Tunnel    ${Bridge-1}    ${Bridge-2}
51     ...    ${tunnel-1}    ${tunnel-2}    ${OPERATIONAL_TOPO_API}
52     Log    >>>>Validating Interface 1 & 2 states<<<<
53     ${return}    Validate interface state    ${tunnel-1}    ${Dpn_id_1}    ${tunnel-2}    ${Dpn_id_2}
54     log    ${return}
55     ${lower-layer-if-1}    Get from List    ${return}    0
56     ${port-num-1}    Get From List    ${return}    1
57     ${lower-layer-if-2}    Get from List    ${return}    2
58     ${port-num-2}    Get From List    ${return}    3
59     Log    >>>>>Verify Oper data base of Interface state<<<<<
60     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/
61     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
62     Log    ${respjson}
63     Should Be Equal As Strings    ${resp.status_code}    200
64     Should Contain    ${resp.content}    ${Dpn_id_1}    ${tunnel-1}
65     Should Contain    ${resp.content}    ${Dpn_id_2}    ${tunnel-2}
66     Log    >>>>> Checking Entry in table 0 on OVS 1<<<<<
67     ${check-3}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_1}    ${Bridge-1}
68     ...    ${port-num-1}
69     Log    >>>>> Checking Entry in table 0 on OVS 2<<<<<
70     ${check-4}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_2}    ${Bridge-2}
71     ...    ${port-num-2}
72     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/opendaylight-inventory:nodes/
73     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
74     Log    ${respjson}
75     Should Be Equal As Strings    ${resp.status_code}    200
76     Should Contain    ${resp.content}    ${lower-layer-if-1}    ${lower-layer-if-2}
77
78 Delete and Verify VTEP -No Vlan
79     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
80     Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
81     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm-state:tunnels_state/
82     Should Not Contain    ${resp}    ${tunnel-1}    ${tunnel-2}
83     ${Ovs-del-1}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_1}    ${tunnel-1}
84     ${Ovs-del-2}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_2}    ${tunnel-2}
85
86 Create and Verify VTEP IPv6 - No Vlan
87     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs without VLAN and Gateway configured in Json.
88     ${Dpn_id_1}    Genius.Get Dpn Ids    ${conn_id_1}
89     ${Dpn_id_2}    Genius.Get Dpn Ids    ${conn_id_2}
90     ${vlan}=    Set Variable    0
91     ${gateway-ip}=    Set Variable    ::
92     ${TOOLS_SYSTEM_IP}    Set Variable    fd96:2a25:4ad3:3c7d:0:0:0:1000
93     ${TOOLS_SYSTEM_2_IP}    Set Variable    fd96:2a25:4ad3:3c7d:0:0:0:2000
94     Create Vteps IPv6    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
95     Wait Until Keyword Succeeds    40    10    Get ITM    ${itm_created[0]}    ${subnet}    ${vlan}
96     ...    ${Dpn_id_1}    ${TOOLS_SYSTEM_IP}    ${Dpn_id_2}    ${TOOLS_SYSTEM_2_IP}
97     ${type}    set variable    odl-interface:tunnel-type-vxlan
98     ${tunnel-1}    Wait Until Keyword Succeeds    40    10    Get Tunnel    ${Dpn_id_1}    ${Dpn_id_2}
99     ...    ${type}
100     Set Global Variable    ${tunnel-1}
101     ${tunnel-2}    Wait Until Keyword Succeeds    40    10    Get Tunnel    ${Dpn_id_2}    ${Dpn_id_1}
102     ...    ${type}
103     Set Global Variable    ${tunnel-2}
104     ${tunnel-type}=    Set Variable    type: vxlan
105     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/    headers=${ACCEPT_XML}
106     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/    headers=${ACCEPT_XML}
107     Log    >>>>OVS Validation in Switch 1 for Tunnel Created<<<<<
108     Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_1}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}
109     ...    ${tunnel-1}    ${tunnel-type}
110     Log    >>>>OVS Validation in Switch 2 for Tunnel Created<<<<<
111     Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_2}    ${TOOLS_SYSTEM_2_IP}    ${TOOLS_SYSTEM_IP}
112     ...    ${tunnel-2}    ${tunnel-type}
113     Log    >>>> Getting Network Topology Operational <<<<<<
114     ${resp}    Wait Until Keyword Succeeds    40    10    Get Network Topology with Tunnel    ${Bridge-1}    ${Bridge-2}
115     ...    ${tunnel-1}    ${tunnel-2}    ${OPERATIONAL_TOPO_API}
116
117 Delete and Verify VTEP IPv6 -No Vlan
118     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
119     Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
120     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm-state:tunnels_state/
121     Should Not Contain    ${resp}    ${tunnel-1}    ${tunnel-2}
122     ${Ovs-del-1}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_1}    ${tunnel-1}
123     ${Ovs-del-2}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_2}    ${tunnel-2}
124
125 Create and Verify VTEP-Vlan
126     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and \ without Gateway configured in Json.
127     ${Dpn_id_1}    Genius.Get Dpn Ids    ${conn_id_1}
128     ${Dpn_id_2}    Genius.Get Dpn Ids    ${conn_id_2}
129     ${vlan}=    Set Variable    100
130     ${gateway-ip}=    Set Variable    0.0.0.0
131     Genius.Create Vteps    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
132     ${get}    Wait Until Keyword Succeeds    40    10    Get ITM    ${itm_created[0]}    ${subnet}
133     ...    ${vlan}    ${Dpn_id_1}    ${TOOLS_SYSTEM_IP}    ${Dpn_id_2}    ${TOOLS_SYSTEM_2_IP}
134     Log    ${get}
135     ${type}    set variable    odl-interface:tunnel-type-vxlan
136     ${tunnel-3}    Wait Until Keyword Succeeds    40    10    Get Tunnel    ${Dpn_id_1}    ${Dpn_id_2}
137     ...    ${type}
138     log    ${tunnel-3}
139     Set Global Variable    ${tunnel-3}
140     ${tunnel-4}    Wait Until Keyword Succeeds    40    10    Get Tunnel    ${Dpn_id_2}    ${Dpn_id_1}
141     ...    ${type}
142     log    ${tunnel-4}
143     Set Global Variable    ${tunnel-4}
144     ${tunnel-type}=    Set Variable    type: vxlan
145     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/
146     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/
147     Log    >>>>OVS Validation in Switch 1 for Tunnel Created<<<<<
148     Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_1}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}
149     ...    ${tunnel-3}    ${tunnel-type}
150     Log    >>>>OVS Validation in Switch 2 for Tunnel Created<<<<<
151     Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_2}    ${TOOLS_SYSTEM_2_IP}    ${TOOLS_SYSTEM_IP}
152     ...    ${tunnel-4}    ${tunnel-type}
153     Log    >>>>> Checking Network opertional Topology <<<<<<
154     ${url_2}    set variable    ${OPERATIONAL_API}/network-topology:network-topology/
155     Wait Until Keyword Succeeds    40    10    Get Network Topology with Tunnel    ${Bridge-1}    ${Bridge-2}    ${tunnel-3}
156     ...    ${tunnel-4}    ${url_2}
157     ${return}    Validate interface state    ${tunnel-3}    ${Dpn_id_1}    ${tunnel-4}    ${Dpn_id_2}
158     log    ${return}
159     ${lower-layer-if-1}    Get from List    ${return}    0
160     ${port-num-1}    Get From List    ${return}    1
161     ${lower-layer-if-2}    Get from List    ${return}    2
162     ${port-num-2}    Get From List    ${return}    3
163     Log    >>>>>Verify Oper data base of Interface state<<<<<
164     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/
165     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
166     Log    ${respjson}
167     Should Contain    ${resp.content}    ${Dpn_id_1}    ${tunnel-3}
168     Should Contain    ${resp.content}    ${Dpn_id_2}    ${tunnel-4}
169     Log    >>>>> Checking Entry in table 0 on OVS 1<<<<<
170     Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_1}    ${Bridge-1}    ${port-num-1}
171     Log    >>>>> Checking Entry in table 0 on OVS \ 2<<<<<
172     Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_2}    ${Bridge-2}    ${port-num-2}
173     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/opendaylight-inventory:nodes/
174     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
175     Log    ${respjson}
176     Should Be Equal As Strings    ${resp.status_code}    200
177     Should Contain    ${resp.content}    ${lower-layer-if-2}    ${lower-layer-if-1}
178
179 Delete and Verify VTEP -Vlan
180     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
181     Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
182     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm-state:tunnels_state/
183     Should Not Contain    ${resp}    ${tunnel-1}    ${tunnel-2}
184     ${Ovs-del-1}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_1}    ${tunnel-1}
185     ${Ovs-del-2}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_2}    ${tunnel-2}
186
187 Create VTEP - Vlan and Gateway
188     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and Gateway configured in Json.
189     ${Dpn_id_1}    Genius.Get Dpn Ids    ${conn_id_1}
190     ${Dpn_id_2}    Genius.Get Dpn Ids    ${conn_id_2}
191     ${vlan}=    Set Variable    101
192     ${substr}    Should Match Regexp    ${TOOLS_SYSTEM_IP}    [0-9]\{1,3}\.[0-9]\{1,3}\.[0-9]\{1,3}\.
193     ${subnet}    Catenate    ${substr}0
194     ${gateway-ip}    Catenate    ${substr}1
195     Log    ${subnet}
196     Genius.Create Vteps    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
197     Wait Until Keyword Succeeds    40    10    Get ITM    ${itm_created[0]}    ${subnet}    ${vlan}
198     ...    ${Dpn_id_1}    ${TOOLS_SYSTEM_IP}    ${Dpn_id_2}    ${TOOLS_SYSTEM_2_IP}
199     ${type}    set variable    odl-interface:tunnel-type-vxlan
200     ${tunnel-5}    Wait Until Keyword Succeeds    40    10    Get Tunnel    ${Dpn_id_1}    ${Dpn_id_2}
201     ...    ${type}
202     log    ${tunnel-5}
203     Set Global Variable    ${tunnel-5}
204     ${tunnel-6}    Wait Until Keyword Succeeds    40    10    Get Tunnel    ${Dpn_id_2}    ${Dpn_id_1}
205     ...    ${type}
206     log    ${tunnel-6}
207     Set Global Variable    ${tunnel-6}
208     ${tunnel-type}=    Set Variable    type: vxlan
209     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/
210     Wait Until Keyword Succeeds    40    5    Get Data From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/
211     Log    >>>>OVS Validation in Switch 1 for Tunnel Created<<<<<
212     ${check-1}    Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_1}    ${TOOLS_SYSTEM_IP}
213     ...    ${TOOLS_SYSTEM_2_IP}    ${tunnel-5}    ${tunnel-type}
214     Log    ${check-1}
215     ${check-2}    Wait Until Keyword Succeeds    40    10    Genius.Ovs Verification For 2 Dpn    ${conn_id_2}    ${TOOLS_SYSTEM_2_IP}
216     ...    ${TOOLS_SYSTEM_IP}    ${tunnel-6}    ${tunnel-type}
217     Log    ${check-2}
218     ${resp}    Wait Until Keyword Succeeds    40    10    Get Network Topology with Tunnel    ${Bridge-1}    ${Bridge-2}
219     ...    ${tunnel-5}    ${tunnel-6}    ${OPERATIONAL_TOPO_API}
220     Log    ${resp}
221     ${return}    Validate interface state    ${tunnel-5}    ${Dpn_id_1}    ${tunnel-6}    ${Dpn_id_2}
222     log    ${return}
223     ${lower-layer-if-1}    Get from List    ${return}    0
224     ${port-num-1}    Get From List    ${return}    1
225     ${lower-layer-if-2}    Get from List    ${return}    2
226     ${port-num-2}    Get From List    ${return}    3
227     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/
228     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
229     Log    ${respjson}
230     Should Contain    ${resp.content}    ${Dpn_id_1}    ${tunnel-5}
231     Should Contain    ${resp.content}    ${Dpn_id_2}    ${tunnel-6}
232     ${check-3}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_1}    ${Bridge-1}
233     ...    ${port-num-1}
234     Log    ${check-3}
235     ${check-4}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_2}    ${Bridge-2}
236     ...    ${port-num-2}
237     Log    ${check-4}
238     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/opendaylight-inventory:nodes/
239     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
240     Log    ${respjson}
241     Should Be Equal As Strings    ${resp.status_code}    200
242     Should Contain    ${resp.content}    ${lower-layer-if-2}    ${lower-layer-if-1}
243
244 Delete VTEP -Vlan and gateway
245     [Documentation]    This testcase deletes the ITM tunnel created between 2 dpns.
246     Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
247     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm-state:tunnels_state/
248     Should Not Contain    ${resp}    ${tunnel-1}    ${tunnel-2}
249     ${Ovs-del-1}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_1}    ${tunnel-1}
250     ${Ovs-del-2}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_2}    ${tunnel-2}
251
252 *** Keywords ***
253 Create Vteps IPv6
254     [Arguments]    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
255     [Documentation]    This keyword creates VTEPs between ${TOOLS_SYSTEM_IP} and ${TOOLS_SYSTEM_2_IP}
256     ${body}    OperatingSystem.Get File    ${genius_config_dir}/Itm_creation_no_vlan.json
257     ${substr}    Should Match Regexp    ${TOOLS_SYSTEM_IP}    [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}:
258     ${subnet}    Catenate    ${substr}0
259     Log    ${subnet}
260     Set Global Variable    ${subnet}
261     ${vlan}=    Set Variable    ${vlan}
262     ${gateway-ip}=    Set Variable    ${gateway-ip}
263     ${body}    Genius.Set Json    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}
264     ...    ${gateway-ip}    ${subnet}
265     Post Log Check    ${CONFIG_API}/itm:transport-zones/    ${body}    204
266
267 Get Tunnel
268     [Arguments]    ${src}    ${dst}    ${type}
269     [Documentation]    This Keyword Gets the Tunnel /Interface name which has been created between 2 DPNS by passing source , destination DPN Ids along with the type of tunnel which is configured.
270     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${src}/${dst}/${type}/
271     log    ${resp.content}
272     Log    ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${src}/${dst}/
273     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
274     Log    ${respjson}
275     Should Be Equal As Strings    ${resp.status_code}    200
276     Should Contain    ${resp.content}    ${src}    ${dst}
277     ${json}=    evaluate    json.loads('''${resp.content}''')    json
278     log to console    \nOriginal JSON:\n${json}
279     ${return}    Run Keyword And Return Status    Should contain    ${resp.content}    tunnel-interface-names
280     log    ${return}
281     ${ret}    Run Keyword If    '${return}'=='True'    Check Interface Name    ${json["internal-tunnel"][0]}    tunnel-interface-names
282     [Return]    ${ret}
283
284 Validate interface state
285     [Arguments]    ${tunnel-1}    ${dpid-1}    ${tunnel-2}    ${dpid-2}
286     [Documentation]    Validates the created Interface Tunnel by checking its Operational status as UP/DOWN from the dump.
287     Log    ${tunnel-1},${dpid-1},${tunnel-2},${dpid-2}
288     ${data1-2}    Wait Until Keyword Succeeds    40    10    Check Interface Status    ${tunnel-1}    ${dpid-1}
289     ${data2-1}    Wait Until Keyword Succeeds    40    10    Check Interface Status    ${tunnel-2}    ${dpid-2}
290     @{data}    combine lists    ${data1-2}    ${data2-1}
291     log    ${data}
292     [Return]    ${data}
293
294 Get ITM
295     [Arguments]    ${itm_created[0]}    ${subnet}    ${vlan}    ${Dpn_id_1}    ${TOOLS_SYSTEM_IP}    ${Dpn_id_2}
296     ...    ${TOOLS_SYSTEM_2_IP}
297     [Documentation]    It returns the created ITM Transport zone with the passed values during the creation is done.
298     Log    ${itm_created[0]},${subnet}, ${vlan}, ${Dpn_id_1},${TOOLS_SYSTEM_IP}, ${Dpn_id_2}, ${TOOLS_SYSTEM_2_IP}
299     @{Itm-no-vlan}    Create List    ${itm_created[0]}    ${subnet}    ${vlan}    ${Dpn_id_1}    ${Bridge-1}-eth1
300     ...    ${TOOLS_SYSTEM_IP}    ${Dpn_id_2}    ${Bridge-2}-eth1    ${TOOLS_SYSTEM_2_IP}
301     Check For Elements At URI    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}    ${Itm-no-vlan}
302
303 Get Network Topology with Tunnel
304     [Arguments]    ${Bridge-1}    ${Bridge-2}    ${tunnel-1}    ${tunnel-2}    ${url}
305     [Documentation]    Returns the Network topology with Tunnel info in it.
306     @{bridges}    Create List    ${Bridge-1}    ${Bridge-2}    ${tunnel-1}    ${tunnel-2}
307     Check For Elements At URI    ${url}    ${bridges}
308
309 Get Network Topology without Tunnel
310     [Arguments]    ${url}    ${tunnel-1}    ${tunnel-2}
311     [Documentation]    Returns the Network Topology after Deleting of ITM transport zone is done , which wont be having any TUNNEL info in it.
312     @{tunnels}    create list    ${tunnel-1}    ${tunnel-2}
313     Check For Elements Not At URI    ${url}    ${tunnels}
314
315 Validate interface state Delete
316     [Arguments]    ${tunnel}
317     [Documentation]    Check for the Tunnel / Interface absence in OPERATIONAL data base of IETF interface after ITM transport zone is deleted.
318     Log    ${tunnel}
319     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${tunnel}/
320     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
321     Log    ${respjson}
322     Should Be Equal As Strings    ${resp.status_code}    404
323     Should not contain    ${resp.content}    ${tunnel}
324
325 check-Tunnel-delete-on-ovs
326     [Arguments]    ${connection-id}    ${tunnel}
327     [Documentation]    Verifies the Tunnel is deleted from OVS
328     Log    ${tunnel}
329     Switch Connection    ${connection-id}
330     Log    ${connection-id}
331     ${return}    Execute Command    sudo ovs-vsctl show
332     Log    ${return}
333     Should Not Contain    ${return}    ${tunnel}
334     [Return]    ${return}
335
336 Check Interface Status
337     [Arguments]    ${tunnel}    ${dpid}
338     [Documentation]    Verifies the operational state of the interface .
339     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${tunnel}/
340     Log    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${tunnel}/
341     ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
342     Log    ${respjson}
343     Should Be Equal As Strings    ${resp.status_code}    200
344     Should not contain    ${resp.content}    down
345     Should Contain    ${resp.content}    ${tunnel}    up    up
346     ${result-1}    re.sub    <.*?>    ,    ${resp.content}
347     Log    ${result-1}
348     ${lower_layer_if}    Should Match Regexp    ${result-1}    openflow:${dpid}:[0-9]+
349     log    ${lower_layer_if}
350     @{resp_array}    Split String    ${lower_layer_if}    :
351     ${port-num}    Get From List    ${resp_array}    2
352     Log    ${port-num}
353     [Return]    ${lower_layer_if}    ${port-num}
354
355 Verify Data Base after Delete
356     [Arguments]    ${Dpn_id_1}    ${Dpn_id_2}    ${tunnel-1}    ${tunnel-2}
357     [Documentation]    Verifies the config database after the Tunnel deletion is done.
358     ${type}    set variable    odl-interface:tunnel-type-vxlan
359     No Content From URI    session    ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${Dpn_id_1}/${Dpn_id_2}/${type}/
360     No Content From URI    session    ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${Dpn_id_2}/${Dpn_id_1}/${type}/
361     No Content From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/
362     No Content From URI    session    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/
363     ${resp_7}    RequestsLibrary.Get Request    session    ${CONFIG_API}/ietf-interfaces:interfaces/
364     Run Keyword if    '${resp_7.content}'=='404'    Response is 404
365     Run Keyword if    '${resp_7.content}'=='200'    Response is 200
366     ${resp_8}    Wait Until Keyword Succeeds    40    10    Get Network Topology without Tunnel    ${CONFIG_TOPO_API}    ${tunnel-1}
367     ...    ${tunnel-2}
368     Log    ${resp_8}
369     ${Ovs-del-1}    Wait Until Keyword Succeeds    40    10    check-Tunnel-delete-on-ovs    ${conn_id_1}    ${tunnel-1}
370     Log    ${Ovs-del-1}
371     ${Ovs-del-2}    Wait Until Keyword Succeeds    40    10    check-Tunnel-delete-on-ovs    ${conn_id_2}    ${tunnel-2}
372     Log    ${Ovs-del-2}
373     Log    >>>>>>> Getting Network Topology Config without Tunnels<<<<<<<
374     Wait Until Keyword Succeeds    40    10    Get Network Topology without Tunnel    ${OPERATIONAL_TOPO_API}    ${tunnel-1}    ${tunnel-2}
375     Wait Until Keyword Succeeds    40    10    Validate interface state Delete    ${tunnel-1}
376     Wait Until Keyword Succeeds    40    10    Validate interface state Delete    ${tunnel-2}
377
378 Check Interface Name
379     [Arguments]    ${json}    ${expected_tunnel_interface_name}
380     [Documentation]    This keyword Checks the Tunnel interface name is tunnel-interface-names in the output or not .
381     ${Tunnels}    Collections.Get From Dictionary    ${json}    ${expected_tunnel_interface_name}
382     Log    ${Tunnels}
383     [Return]    ${Tunnels[0]}