2 Documentation Test Suite for vpn instance
3 Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
5 Variables ../../variables/vpnservice/configureSwitches.py ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP}
7 Variables ../../variables/Variables.py
8 Resource ../../libraries/Utils.robot
9 Library RequestsLibrary
12 ${REST_CON} /restconf/config
13 @{vpn_inst_values} testVpn1 100:1 200:1 300:1 testVpn2 400:1 500:1
15 @{ietf_int_values} s1-eth1 s1-eth2 s1-gre1 s2-eth1 s2-eth2 s2-gre1
16 @{vpn_int_values} s1-eth1 testVpn1 10.0.0.1 00:00:00:00:00:01 s1-eth2 10.0.0.2 00:00:00:00:00:02
17 ... s2-eth1 10.0.0.3 00:00:00:00:00:03 testVpn2 s2-eth2 10.0.0.4 00:00:00:00:00:04
18 ${REST_OPER} /restconf/operational
19 @{NODE_ELEMENTS} openflow:1 openflow:1:1 openflow:1:2 openflow:1:3 openflow:2 openflow:2:1 openflow:2:2
24 [Documentation] Verifies if the switches and node connectors data is available to the controller
25 Check For Elements At URI ${REST_OPER}/opendaylight-inventory:nodes/ ${NODE_ELEMENTS}
28 [Documentation] Creates VPN Instances through restconf
30 CompareStream.Run_Keyword_If_Less_Than_Magnesium ${resp} RequestsLibrary.Post Request session ${REST_CON}/l3vpn:vpn-instances/ data=${vpn_instances}
31 CompareStream.Run_Keyword_If_At_Least_Magnesium ${resp} RequestsLibrary.Post Request session ${REST_CON}/l3vpn-instances-interfaces:vpn-instances/ data=${vpn_instances}
33 Should Be Equal As Strings ${resp.status_code} 204
36 [Documentation] Verifies the vpn instances in the datastores
38 CompareStream.Run_Keyword_If_Less_Than_Magnesium Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_CON}/l3vpn:vpn-instances/ ${vpn_inst_values}
39 CompareStream.Run_Keyword_If_Less_Than_Magnesium Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_OPER}/l3vpn:vpn-instances/ ${vpn_inst_values}
40 CompareStream.Run_Keyword_If_At_Least_Magnesium Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_CON}/l3vpn-instances-interfaces:vpn-instances/ ${vpn_inst_values}
41 CompareStream.Run_Keyword_If_At_Least_Magnesium Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_OPER}/l3vpn-instances-interfaces:vpn-instances/ ${vpn_inst_values}
43 Create ietf interfaces
44 [Documentation] Creates ietf interfaces through the restconf
46 ${resp} RequestsLibrary.Post Request session ${REST_CON}/ietf-interfaces:interfaces/ data=${ietf_interfaces}
47 Should Be Equal As Strings ${resp.status_code} 204
49 Verify ietf interfaces
50 [Documentation] Verifies ietf interfaces created in datastores
52 Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_CON}/ietf-interfaces:interfaces/ ${ietf_int_values}
53 Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_OPER}/ietf-interfaces:interfaces-state/ ${ietf_int_values}
54 @{state}= Create List down
55 Wait Until Keyword Succeeds 2s 1s Check For Elements Not At URI ${REST_OPER}/ietf-interfaces:interfaces-state/ ${state}
58 [Documentation] Creates vpn interface for the corresponding ietf interface
60 CompareStream.Run_Keyword_If_Less_Than_Magnesium ${resp} RequestsLibrary.Post Request session ${REST_CON}/l3vpn:vpn-interfaces/ data=${vpn_instances}
61 CompareStream.Run_Keyword_If_At_Least_Magnesium ${resp} RequestsLibrary.Post Request session ${REST_CON}/l3vpn-instances-interfaces:vpn-interfaces/ data=${vpn_instances}
62 Should Be Equal As Strings ${resp.status_code} 204
65 [Documentation] Verifies the vpn interfaces created in datastores
67 CompareStream.Run_Keyword_If_Less_Than_Magnesium Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_CON}/l3vpn:vpn-interfaces/ ${vpn_int_values}
68 CompareStream.Run_Keyword_If_Less_Than_Magnesium Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_OPER}/l3vpn:vpn-interfaces/ ${vpn_int_values}
69 CompareStream.Run_Keyword_If_At_Least_Magnesium Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_CON}/l3vpn-instances-interfaces:vpn-interfaces/ ${vpn_int_values}
70 CompareStream.Run_Keyword_If_At_Least_Magnesium Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_OPER}/l3vpn-instances-interfaces:vpn-interfaces/ ${vpn_int_values}
72 Verify FIB entries after create
73 [Documentation] Verifies the fib entries in the operational DS for the corresponding vpn interfaces
75 @{fib_entries1}= Create List ${vpn_int_values[2]} ${vpn_int_values[8]}
76 @{fib_entries2}= Create List ${vpn_int_values[5]} ${vpn_int_values[12]}
77 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_OPER}/odl-fib:fibEntries/vrfTables/${vpn_inst_values[1]} ${fib_entries1}
78 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_OPER}/odl-fib:fibEntries/vrfTables/${vpn_inst_values[5]} ${fib_entries2}
81 [Documentation] Verify flows in the switches
82 [Tags] verify in switch
83 @{flow_elements} Create List ${vpn_int_values[2]} ${vpn_int_values[5]} ${vpn_int_values[8]} ${vpn_int_values[12]}
84 Wait Until Keyword Succeeds 6s 2s Ensure Flows Are Present ${mininet1_conn_id_1} ${flow_elements}
85 Wait Until Keyword Succeeds 6s 2s Ensure Flows Are Present ${mininet2_conn_id_1} ${flow_elements}
88 [Documentation] Verify groups in the switches
89 [Tags] verify in switch
90 @{group_elements1} Create List ${vpn_int_values[3]} ${vpn_int_values[6]}
91 @{group_elements2} Create List ${vpn_int_values[9]} ${vpn_int_values[13]}
92 Wait Until Keyword Succeeds 5s 1s Ensure Groups Are Present ${mininet1_conn_id_1} ${group_elements1} 3
93 Wait Until Keyword Succeeds 5s 1s Ensure Groups Are Present ${mininet2_conn_id_1} ${group_elements2} 3
96 [Documentation] Verifies the ping between the two hosts. Ping should succeed between hosts in same vpn, (h1,h3) and (h2,h4).Ping between hosts in different vpns should fail (h1,h2) & (h3,h4). The commented out section is to be uncommented when ovs supports mpls over gre in datapath
97 [Tags] verify in switch
98 Switch Connection ${mininet1_conn_id_1}
100 ${result} Read Until mininet>
102 Should Contain ${result} 100% packet loss
104 Delete vpn interfaces
105 [Documentation] Deletes the vpn interfaces
107 CompareStream.Run_Keyword_If_Less_Than_Magnesium ${resp} RequestsLibrary.Delete Request session ${REST_CON}/l3vpn:vpn-interfaces/
108 CompareStream.Run_Keyword_If_At_Least_Magnesium ${resp} RequestsLibrary.Delete Request session ${REST_CON}/l3vpn-instances-interfaces:vpn-interfaces/
109 Should Be Equal As Strings ${resp.status_code} 200
111 Verify after deleting vpn interfaces
112 [Documentation] Verifies if vpn interfaces are deleted
113 [Tags] Verify after delete
114 CompareStream.Run_Keyword_If_Less_Than_Magnesium ${resp} RequestsLibrary.get Request session ${REST_CON}/l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
115 CompareStream.Run_Keyword_If_At_Least_Magnesium ${resp} RequestsLibrary.get Request session ${REST_CON}/l3vpn-instances-interfaces:vpn-interfaces/ headers=${ACCEPT_XML}
116 Should Be Equal As Strings ${resp.status_code} 404
118 Delete ietf interfaces
119 [Documentation] Deletes the ietf interfaces
121 ${resp} RequestsLibrary.Delete Request session ${REST_CON}/ietf-interfaces:interfaces/
122 Should Be Equal As Strings ${resp.status_code} 200
124 Verify after deleting ietf interfaces
125 [Documentation] Verifies if ietf interfaces are deleted
126 [Tags] Verify after delete
127 ${resp} RequestsLibrary.get Request session ${REST_CON}/ietf-interfaces:interfaces/ headers=${ACCEPT_XML}
128 Should Be Equal As Strings ${resp.status_code} 404
131 [Documentation] Deletes the VPN Instances
133 CompareStream.Run_Keyword_If_Less_Than_Magnesium ${resp} RequestsLibrary.Delete Request session ${REST_CON}/l3vpn:vpn-instances/
134 CompareStream.Run_Keyword_If_At_Least_Magnesium ${resp} RequestsLibrary.Delete Request session ${REST_CON}/l3vpn-instances-interfaces:vpn-instances/
135 Should Be Equal As Strings ${resp.status_code} 200
137 Verify after deleting the vpn instances
138 [Documentation] Verifies after deleting the vpn instances
139 [Tags] Verfiy after delete
140 CompareStream.Run_Keyword_If_Less_Than_Magnesium ${resp} RequestsLibrary.get Request session ${REST_CON}/l3vpn:vpn-instances/ headers=${ACCEPT_XML}
141 CompareStream.Run_Keyword_If_At_Least_Magnesium ${resp} RequestsLibrary.get Request session ${REST_CON}/l3vpn-instances-interfaces:vpn-instances/ headers=${ACCEPT_XML}
142 Should Be Equal As Strings ${resp.status_code} 404
144 Verify FIB entries after delete
145 [Documentation] Verifies if the fib entries are deleted in the operational DS
147 @{fib_entries}= Create List ${vpn_int_values[2]} ${vpn_int_values[5]} ${vpn_int_values[8]} ${vpn_int_values[12]}
148 Wait Until Keyword Succeeds 3s 1s Check For Elements Not At URI ${REST_OPER}/odl-fib:fibEntries/ ${fib_entries}
150 Verify flows after delete
151 [Documentation] Verify if the flows are deleted from the switch
152 [Tags] verify in switch
154 Wait Until Keyword Succeeds 12s 2s Ensure Flows Are Removed ${mininet1_conn_id_1}
155 Wait Until Keyword Succeeds 12s 2s Ensure Flows Are Removed ${mininet2_conn_id_1}
158 Ensure Flows Are Present
159 [Arguments] ${conn_id} ${flow_elements}
160 [Documentation] Succeeds if the flows for vpn service are present
161 Switch Connection ${conn_id}
162 Write dpctl dump-flows -O OpenFlow13
163 ${output}= Read Until mininet>
165 Should Contain ${output} goto_table:20
166 Should Contain X Times ${output} goto_table:21 2
167 Should Contain X Times ${output} table=20 2
168 Should Contain X Times ${output} table=21 4
169 FOR ${i} IN @{flow_elements}
170 Should Contain ${output} ${i}
173 Ensure Groups Are Present
174 [Arguments] ${conn_id} ${group_elements} ${gre_port_id}
175 [Documentation] Succeeds if the groups for the vpn service are present
176 Switch Connection ${conn_id}
177 Write dpctl dump-groups -O OpenFlow13
178 ${output}= Read Until mininet>
180 Should Contain X Times ${output} actions=output:${gre_port_id} 1
181 FOR ${i} IN @{group_elements}
182 Should Contain ${output} actions=pop_mpls:0x0800,set_field:${i}
185 Ensure Flows Are Removed
186 [Arguments] ${conn_id}
187 [Documentation] Succeeds if the flows are removed from the switch
188 Switch Connection ${conn_id}
189 Write dpctl dump-flows -O OpenFlow13
190 ${output}= Read Until mininet>
192 Should Not contain ${output} goto_table:20
193 Should Not contain ${output} goto_table:21
194 Should Not contain ${output} table=20
195 Should Not contain ${output} table=21
197 Ensure Groups Are Removed
198 [Arguments] ${conn_id}
199 [Documentation] Succeeds if the group entries are removed from switch
200 Switch Connection ${conn_id}
201 Write dpctl dump-groups -O OpenFlow13
202 ${output}= Read Until mininet>
204 Should Not Contain ${output} actions=output:
205 Should Not Contain ${output} actions=pop_mpls:0x0800