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 ${resp} RequestsLibrary.Post Request session ${REST_CON}/l3vpn:vpn-instances/ data=${vpn_instances}
32 Should Be Equal As Strings ${resp.status_code} 204
35 [Documentation] Verifies the vpn instances in the datastores
37 Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_CON}/l3vpn:vpn-instances/ ${vpn_inst_values}
38 Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_OPER}/l3vpn:vpn-instances/ ${vpn_inst_values}
40 Create ietf interfaces
41 [Documentation] Creates ietf interfaces through the restconf
43 ${resp} RequestsLibrary.Post Request session ${REST_CON}/ietf-interfaces:interfaces/ data=${ietf_interfaces}
44 Should Be Equal As Strings ${resp.status_code} 204
46 Verify ietf interfaces
47 [Documentation] Verifies ietf interfaces created in datastores
49 Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_CON}/ietf-interfaces:interfaces/ ${ietf_int_values}
50 Wait Until Keyword Succeeds 5s 1s Check For Elements At URI ${REST_OPER}/ietf-interfaces:interfaces-state/ ${ietf_int_values}
51 @{state}= Create List down
52 Wait Until Keyword Succeeds 2s 1s Check For Elements Not At URI ${REST_OPER}/ietf-interfaces:interfaces-state/ ${state}
55 [Documentation] Creates vpn interface for the corresponding ietf interface
57 ${resp} RequestsLibrary.Post Request session ${REST_CON}/l3vpn:vpn-interfaces/ data=${vpn_interfaces}
58 Should Be Equal As Strings ${resp.status_code} 204
61 [Documentation] Verifies the vpn interfaces created in datastores
63 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_CON}/l3vpn:vpn-interfaces/ ${vpn_int_values}
64 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_OPER}/l3vpn:vpn-interfaces/ ${vpn_int_values}
66 Verify FIB entries after create
67 [Documentation] Verifies the fib entries in the operational DS for the corresponding vpn interfaces
69 @{fib_entries1}= Create List ${vpn_int_values[2]} ${vpn_int_values[8]}
70 @{fib_entries2}= Create List ${vpn_int_values[5]} ${vpn_int_values[12]}
71 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_OPER}/odl-fib:fibEntries/vrfTables/${vpn_inst_values[1]} ${fib_entries1}
72 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${REST_OPER}/odl-fib:fibEntries/vrfTables/${vpn_inst_values[5]} ${fib_entries2}
75 [Documentation] Verify flows in the switches
76 [Tags] verify in switch
77 @{flow_elements} Create List ${vpn_int_values[2]} ${vpn_int_values[5]} ${vpn_int_values[8]} ${vpn_int_values[12]}
78 Wait Until Keyword Succeeds 6s 2s Ensure Flows Are Present ${mininet1_conn_id_1} ${flow_elements}
79 Wait Until Keyword Succeeds 6s 2s Ensure Flows Are Present ${mininet2_conn_id_1} ${flow_elements}
82 [Documentation] Verify groups in the switches
83 [Tags] verify in switch
84 @{group_elements1} Create List ${vpn_int_values[3]} ${vpn_int_values[6]}
85 @{group_elements2} Create List ${vpn_int_values[9]} ${vpn_int_values[13]}
86 Wait Until Keyword Succeeds 5s 1s Ensure Groups Are Present ${mininet1_conn_id_1} ${group_elements1} 3
87 Wait Until Keyword Succeeds 5s 1s Ensure Groups Are Present ${mininet2_conn_id_1} ${group_elements2} 3
90 [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
91 [Tags] verify in switch
92 Switch Connection ${mininet1_conn_id_1}
94 ${result} Read Until mininet>
96 Should Contain ${result} 100% packet loss
99 [Documentation] Deletes the vpn interfaces
101 ${resp} RequestsLibrary.Delete Request session ${REST_CON}/l3vpn:vpn-interfaces/
102 Should Be Equal As Strings ${resp.status_code} 200
104 Verify after deleting vpn interfaces
105 [Documentation] Verifies if vpn interfaces are deleted
106 [Tags] Verify after delete
107 ${resp} RequestsLibrary.get Request session ${REST_CON}/l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
108 Should Be Equal As Strings ${resp.status_code} 404
110 Delete ietf interfaces
111 [Documentation] Deletes the ietf interfaces
113 ${resp} RequestsLibrary.Delete Request session ${REST_CON}/ietf-interfaces:interfaces/
114 Should Be Equal As Strings ${resp.status_code} 200
116 Verify after deleting ietf interfaces
117 [Documentation] Verifies if ietf interfaces are deleted
118 [Tags] Verify after delete
119 ${resp} RequestsLibrary.get Request session ${REST_CON}/ietf-interfaces:interfaces/ headers=${ACCEPT_XML}
120 Should Be Equal As Strings ${resp.status_code} 404
123 [Documentation] Deletes the VPN Instances
125 ${resp} RequestsLibrary.Delete Request session ${REST_CON}/l3vpn:vpn-instances/
126 Should Be Equal As Strings ${resp.status_code} 200
128 Verify after deleting the vpn instances
129 [Documentation] Verifies after deleting the vpn instances
130 [Tags] Verfiy after delete
131 ${resp} RequestsLibrary.get Request session ${REST_CON}/l3vpn:vpn-instances/ headers=${ACCEPT_XML}
132 Should Be Equal As Strings ${resp.status_code} 404
134 Verify FIB entries after delete
135 [Documentation] Verifies if the fib entries are deleted in the operational DS
137 @{fib_entries}= Create List ${vpn_int_values[2]} ${vpn_int_values[5]} ${vpn_int_values[8]} ${vpn_int_values[12]}
138 Wait Until Keyword Succeeds 3s 1s Check For Elements Not At URI ${REST_OPER}/odl-fib:fibEntries/ ${fib_entries}
140 Verify flows after delete
141 [Documentation] Verify if the flows are deleted from the switch
142 [Tags] verify in switch
144 Wait Until Keyword Succeeds 12s 2s Ensure Flows Are Removed ${mininet1_conn_id_1}
145 Wait Until Keyword Succeeds 12s 2s Ensure Flows Are Removed ${mininet2_conn_id_1}
148 Ensure Flows Are Present
149 [Arguments] ${conn_id} ${flow_elements}
150 [Documentation] Succeeds if the flows for vpn service are present
151 Switch Connection ${conn_id}
152 Write dpctl dump-flows -O OpenFlow13
153 ${output}= Read Until mininet>
155 Should Contain ${output} goto_table:20
156 Should Contain X Times ${output} goto_table:21 2
157 Should Contain X Times ${output} table=20 2
158 Should Contain X Times ${output} table=21 4
159 : FOR ${i} IN @{flow_elements}
160 \ Should Contain ${output} ${i}
162 Ensure Groups Are Present
163 [Arguments] ${conn_id} ${group_elements} ${gre_port_id}
164 [Documentation] Succeeds if the groups for the vpn service are present
165 Switch Connection ${conn_id}
166 Write dpctl dump-groups -O OpenFlow13
167 ${output}= Read Until mininet>
169 Should Contain X Times ${output} actions=output:${gre_port_id} 1
170 : FOR ${i} IN @{group_elements}
171 \ Should Contain ${output} actions=pop_mpls:0x0800,set_field:${i}
173 Ensure Flows Are Removed
174 [Arguments] ${conn_id}
175 [Documentation] Succeeds if the flows are removed from the switch
176 Switch Connection ${conn_id}
177 Write dpctl dump-flows -O OpenFlow13
178 ${output}= Read Until mininet>
180 Should Not contain ${output} goto_table:20
181 Should Not contain ${output} goto_table:21
182 Should Not contain ${output} table=20
183 Should Not contain ${output} table=21
185 Ensure Groups Are Removed
186 [Arguments] ${conn_id}
187 [Documentation] Succeeds if the group entries are removed from switch
188 Switch Connection ${conn_id}
189 Write dpctl dump-groups -O OpenFlow13
190 ${output}= Read Until mininet>
192 Should Not Contain ${output} actions=output:
193 Should Not Contain ${output} actions=pop_mpls:0x0800