2 Documentation Test Suite for vpn instance
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
5 Library ../../libraries/RequestsLibrary.py
6 Variables ../../variables/Variables.py
7 Variables ../../variables/vpnservice/Variables.py
11 ${REST_CON} /restconf/config/
12 @{vpn_inst_values} testVpn1 1000:1 1000:1,2000:1 3000:1,4000:1
13 @{vm_int_values} s1-eth1 l2vlan openflow:1:1
14 @{vm_vpnint_values} s1-eth1 testVpn1 10.0.0.1 12:f8:57:a8:b9:a1
18 [Documentation] Creates VPN Instance through restconf
20 ${resp} Post Json session ${REST_CON}l3vpn:vpn-instances/ data=${vpn_instance}
22 Should Be Equal As Strings ${resp.status_code} 204
25 [Documentation] Verifies the vpn instance is created
27 ${resp} RequestsLibrary.get session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/ headers=${ACCEPT_XML}
28 Should Be Equal As Strings ${resp.status_code} 200
30 : FOR ${value} IN @{vpn_inst_values}
31 \ Should Contain ${resp.content} ${value}
33 Create ietf vm interface
34 [Documentation] Creates ietf interface through the restconf
36 ${resp} Post Json session ${REST_CON}ietf-interfaces:interfaces/ data=${vm_interface}
37 Should Be Equal As Strings ${resp.status_code} 204
39 Verify ietf vm interface
40 [Documentation] Verifies ietf interface created
42 ${resp} RequestsLibrary.get session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]}/ headers=${ACCEPT_XML}
43 Should Be Equal As Strings ${resp.status_code} 200
45 : FOR ${value} IN @{vm_int_values}
46 \ Should Contain ${resp.content} ${value}
49 [Documentation] Creates vpn interface for the corresponding ietf interface
51 ${resp} Post Json session ${REST_CON}l3vpn:vpn-interfaces/ data=${vm_vpninterface}
52 Should Be Equal As Strings ${resp.status_code} 204
55 [Documentation] Verifies the vpn interface created
57 ${resp} RequestsLibrary.get session ${REST_CON}l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
58 Should Be Equal As Strings ${resp.status_code} 200
60 : FOR ${value} IN @{vm_vpnint_values}
61 \ Should Contain ${resp.content} ${value}
63 Verify FIB entry after create
64 [Documentation] Verifies the fib entry for the corresponding vpn interface
66 Wait Until Keyword Succeeds 10s 2s Ensure The Fib Entry Is Present vrfTables/${vpn_inst_values[1]}/vrfEntry/${vm_vpnint_values[2]}/ ${vm_vpnint_values[2]}
68 Delete vm vpn interface
69 [Documentation] Deletes the vpn interface
71 ${resp} RequestsLibrary.Delete session ${REST_CON}l3vpn:vpn-interfaces/
72 Should Be Equal As Strings ${resp.status_code} 200
74 Verify after deleteing vm vpn interface
75 [Documentation] Verifies vpn interface after delete
76 [Tags] Verify after delete
77 ${resp} RequestsLibrary.get session ${REST_CON}l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
78 Should Be Equal As Strings ${resp.status_code} 404
81 [Documentation] Deletes the VPN Instance
83 ${resp} RequestsLibrary.Delete session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/
84 Should Be Equal As Strings ${resp.status_code} 200
86 Verify after deleting the vpn instance
87 [Documentation] Verifies after deleting the vpn instance
88 [Tags] Verfiy after delete
89 ${resp} RequestsLibrary.get session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/ headers=${ACCEPT_XML}
90 Should Be Equal As Strings ${resp.status_code} 404
92 Delete vm ietf interface
93 [Documentation] Deletes the ietf interface
95 ${resp} RequestsLibrary.Delete session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]}
96 Should Be Equal As Strings ${resp.status_code} 200
98 Verify after deleting vm ietf interface
99 [Documentation] Verifies ietf interface after delete
100 [Tags] Verify after delete
101 ${resp} RequestsLibrary.get session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]} headers=${ACCEPT_XML}
102 Should Be Equal As Strings ${resp.status_code} 404
104 Verify FIB entry after delete
105 [Documentation] Verifies the fib entry is deleted for the corresponding vpn interface
107 Wait Until Keyword Succeeds 10s 2s Ensure The Fib Entry Is Removed vrfTables/${vpn_inst_values[1]}/vrfEntry/${vm_vpnint_values[2]}/
110 Ensure The Fib Entry Is Present
111 [Arguments] ${uri_part} ${prefix}
112 [Documentation] Will succeed if the fib entry is present for the vpn
113 ${resp} RequestsLibrary.get session ${REST_CON}odl-fib:fibEntries/${uri_part} headers=${ACCEPT_XML}
114 Should Be Equal As Strings ${resp.status_code} 200
116 Should Contain ${resp.content} ${prefix}
117 Should Contain ${resp.content} label
119 Ensure the Fib Entry Is Removed
120 [Arguments] ${uri_part}
121 [Documentation] Will succeed if the fib entry is removed for the vpn
122 ${resp} RequestsLibrary.get session ${REST_CON}odl-fib:fibEntries/${uri_part} headers=${ACCEPT_XML}
123 Should Be Equal As Strings ${resp.status_code} 404