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 Library OperatingSystem
7 Library RequestsLibrary
8 Variables ../../variables/Variables.py
12 ${REST_CON} /restconf/config/
13 @{vpn_inst_values} testVpn1 1000:1 1000:1,2000:1 3000:1,4000:1
14 @{vm_int_values} s1-eth1 l2vlan openflow:1:1
15 @{vm_vpnint_values} s1-eth1 testVpn1 10.0.0.1 12:f8:57:a8:b9:a1
16 ${VPN_CONFIG_DIR} ${CURDIR}/../../variables/vpnservice
20 [Documentation] Creates VPN Instance through restconf
22 ${body} OperatingSystem.Get File ${VPN_CONFIG_DIR}/vpn_instance.json
23 ${resp} RequestsLibrary.Post Request session ${REST_CON}l3vpn:vpn-instances/ data=${body}
25 Should Be Equal As Strings ${resp.status_code} 204
28 [Documentation] Verifies the vpn instance is created
30 ${resp} RequestsLibrary.Get Request session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/ headers=${ACCEPT_XML}
31 Should Be Equal As Strings ${resp.status_code} 200
33 FOR ${value} IN @{vpn_inst_values}
34 Should Contain ${resp.content} ${value}
37 Create ietf vm interface
38 [Documentation] Creates ietf interface through the restconf
40 ${body} OperatingSystem.Get File ${VPN_CONFIG_DIR}/vm_interface.json
41 ${resp} RequestsLibrary.Post Request session ${REST_CON}ietf-interfaces:interfaces/ data=${body}
42 Should Be Equal As Strings ${resp.status_code} 204
44 Verify ietf vm interface
45 [Documentation] Verifies ietf interface created
47 ${resp} RequestsLibrary.Get Request session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]}/ headers=${ACCEPT_XML}
48 Should Be Equal As Strings ${resp.status_code} 200
50 FOR ${value} IN @{vm_int_values}
51 Should Contain ${resp.content} ${value}
55 [Documentation] Creates vpn interface for the corresponding ietf interface
57 ${body} OperatingSystem.Get File ${VPN_CONFIG_DIR}/vm_vpninterface.json
58 ${resp} RequestsLibrary.Post Request session ${REST_CON}l3vpn:vpn-interfaces/ data=${body}
59 Should Be Equal As Strings ${resp.status_code} 204
62 [Documentation] Verifies the vpn interface created
64 ${resp} RequestsLibrary.Get Request session ${REST_CON}l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
65 Should Be Equal As Strings ${resp.status_code} 200
67 FOR ${value} IN @{vm_vpnint_values}
68 Should Contain ${resp.content} ${value}
71 Verify FIB entry after create
72 [Documentation] Verifies the fib entry for the corresponding vpn interface
74 Wait Until Keyword Succeeds 5s 1s Ensure The Fib Entry Is Present ${vm_vpnint_values[2]}
76 Delete vm vpn interface
77 [Documentation] Deletes the vpn interface
79 ${resp} RequestsLibrary.Delete Request session ${REST_CON}l3vpn:vpn-interfaces/
80 Should Be Equal As Strings ${resp.status_code} 200
82 Verify after deleteing vm vpn interface
83 [Documentation] Verifies vpn interface after delete
84 [Tags] Verify after delete
85 ${resp} RequestsLibrary.Get Request session ${REST_CON}l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
86 Should Be Equal As Strings ${resp.status_code} 404
89 [Documentation] Deletes the VPN Instance
91 ${resp} RequestsLibrary.Delete Request session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/
92 Should Be Equal As Strings ${resp.status_code} 200
94 Verify after deleting the vpn instance
95 [Documentation] Verifies after deleting the vpn instance
96 [Tags] Verfiy after delete
97 ${resp} RequestsLibrary.Get Request session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/ headers=${ACCEPT_XML}
98 Should Be Equal As Strings ${resp.status_code} 404
100 Delete vm ietf interface
101 [Documentation] Deletes the ietf interface
103 ${resp} RequestsLibrary.Delete Request session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]}
104 Should Be Equal As Strings ${resp.status_code} 200
106 Verify after deleting vm ietf interface
107 [Documentation] Verifies ietf interface after delete
108 [Tags] Verify after delete
109 ${resp} RequestsLibrary.Get Request session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]} headers=${ACCEPT_XML}
110 Should Be Equal As Strings ${resp.status_code} 404
112 Verify FIB entry after delete
113 [Documentation] Verifies the fib entry is deleted for the corresponding vpn interface
115 Wait Until Keyword Succeeds 5s 1s Ensure The Fib Entry Is Removed ${vm_vpnint_values[2]}
118 Ensure The Fib Entry Is Present
119 [Arguments] ${prefix}
120 [Documentation] Will succeed if the fib entry is present for the vpn
121 ${resp} RequestsLibrary.Get Request session /restconf/operational/odl-fib:fibEntries/ headers=${ACCEPT_XML}
122 Should Be Equal As Strings ${resp.status_code} 200
124 Should Contain ${resp.content} ${prefix}
125 Should Contain ${resp.content} label
127 Ensure the Fib Entry Is Removed
128 [Arguments] ${prefix}
129 [Documentation] Will succeed if the fib entry is removed for the vpn
130 ${resp} RequestsLibrary.Get Request session /restconf/operational/odl-fib:fibEntries/ headers=${ACCEPT_XML}
131 Should Be Equal As Strings ${resp.status_code} 200
132 Should Not Contain ${resp.content} ${prefix}