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 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 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 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}
36 Create ietf vm interface
37 [Documentation] Creates ietf interface through the restconf
39 ${body} OperatingSystem.Get File ${VPN_CONFIG_DIR}/vm_interface.json
40 ${resp} RequestsLibrary.Post session ${REST_CON}ietf-interfaces:interfaces/ data=${body}
41 Should Be Equal As Strings ${resp.status_code} 204
43 Verify ietf vm interface
44 [Documentation] Verifies ietf interface created
46 ${resp} RequestsLibrary.Get session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]}/ headers=${ACCEPT_XML}
47 Should Be Equal As Strings ${resp.status_code} 200
49 : FOR ${value} IN @{vm_int_values}
50 \ Should Contain ${resp.content} ${value}
53 [Documentation] Creates vpn interface for the corresponding ietf interface
55 ${body} OperatingSystem.Get File ${VPN_CONFIG_DIR}/vm_vpninterface.json
56 ${resp} RequestsLibrary.Post session ${REST_CON}l3vpn:vpn-interfaces/ data=${body}
57 Should Be Equal As Strings ${resp.status_code} 204
60 [Documentation] Verifies the vpn interface created
62 ${resp} RequestsLibrary.Get session ${REST_CON}l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
63 Should Be Equal As Strings ${resp.status_code} 200
65 : FOR ${value} IN @{vm_vpnint_values}
66 \ Should Contain ${resp.content} ${value}
68 Verify FIB entry after create
69 [Documentation] Verifies the fib entry for the corresponding vpn interface
71 Wait Until Keyword Succeeds 5s 1s Ensure The Fib Entry Is Present ${vm_vpnint_values[2]}
73 Delete vm vpn interface
74 [Documentation] Deletes the vpn interface
76 ${resp} RequestsLibrary.Delete session ${REST_CON}l3vpn:vpn-interfaces/
77 Should Be Equal As Strings ${resp.status_code} 200
79 Verify after deleteing vm vpn interface
80 [Documentation] Verifies vpn interface after delete
81 [Tags] Verify after delete
82 ${resp} RequestsLibrary.Get session ${REST_CON}l3vpn:vpn-interfaces/ headers=${ACCEPT_XML}
83 Should Be Equal As Strings ${resp.status_code} 404
86 [Documentation] Deletes the VPN Instance
88 ${resp} RequestsLibrary.Delete session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/
89 Should Be Equal As Strings ${resp.status_code} 200
91 Verify after deleting the vpn instance
92 [Documentation] Verifies after deleting the vpn instance
93 [Tags] Verfiy after delete
94 ${resp} RequestsLibrary.Get session ${REST_CON}l3vpn:vpn-instances/vpn-instance/${vpn_inst_values[0]}/ headers=${ACCEPT_XML}
95 Should Be Equal As Strings ${resp.status_code} 404
97 Delete vm ietf interface
98 [Documentation] Deletes the ietf interface
100 ${resp} RequestsLibrary.Delete session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]}
101 Should Be Equal As Strings ${resp.status_code} 200
103 Verify after deleting vm ietf interface
104 [Documentation] Verifies ietf interface after delete
105 [Tags] Verify after delete
106 ${resp} RequestsLibrary.Get session ${REST_CON}ietf-interfaces:interfaces/interface/${vm_int_values[0]} headers=${ACCEPT_XML}
107 Should Be Equal As Strings ${resp.status_code} 404
109 Verify FIB entry after delete
110 [Documentation] Verifies the fib entry is deleted for the corresponding vpn interface
112 Wait Until Keyword Succeeds 5s 1s Ensure The Fib Entry Is Removed ${vm_vpnint_values[2]}
115 Ensure The Fib Entry Is Present
116 [Arguments] ${prefix}
117 [Documentation] Will succeed if the fib entry is present for the vpn
118 ${resp} RequestsLibrary.Get session /restconf/operational/odl-fib:fibEntries/ headers=${ACCEPT_XML}
119 Should Be Equal As Strings ${resp.status_code} 200
121 Should Contain ${resp.content} ${prefix}
122 Should Contain ${resp.content} label
124 Ensure the Fib Entry Is Removed
125 [Arguments] ${prefix}
126 [Documentation] Will succeed if the fib entry is removed for the vpn
127 ${resp} RequestsLibrary.Get session /restconf/operational/odl-fib:fibEntries/ headers=${ACCEPT_XML}
128 Should Be Equal As Strings ${resp.status_code} 200
129 Should Not Contain ${resp.content} ${prefix}