Merge "Update VTN Manager adoc for Beryllium"
[docs.git] / manuals / user-guide / src / main / asciidoc / vtn / VTN_Manager_How_To_Configure_Service_Function_Chaining_Support.adoc
1 ==== How To Configure Service Function Chaining using VTN Manager
2
3 ===== Overview
4
5 This page explains how to configure VTN Manager for Service Chaining. This page targets Beryllium release, so the procedure described here does not work in other releases.
6
7 .Service Chaining With One Service
8 image::vtn/Service_Chaining_With_One_Service.png["Service Chaining With One Service",width=500]
9
10 ===== Requirements
11
12 * Please refer to the https://wiki.opendaylight.org/view/VTN:Beryllium:Installation_Guide[Installation Pages] to run ODL with VTN Feature enabled.
13 * Please ensure Bridge-Utils package is installed in mininet environment before running the mininet script.
14 * To install Bridge-Utils package run sudo apt-get install bridge-utils (assuming Ubuntu is used to run mininet, If not then this is not required).
15 * Save the mininet script given below as topo_handson.py and run the mininet script in the mininet environment where Mininet is installed.
16
17 ===== Mininet Script
18
19 * https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:Mininet[Script for emulating network with multiple hosts].
20 * Before executing the mininet script, please confirm Controller is up and running.
21 * Run the mininet script.
22 * Replace <path> and <Controller IP> based on your environment
23
24 ----
25 sudo mn --controller=remote,ip=<Controller IP> --custom <path>\topo_handson.py --topo mytopo2
26 ----
27
28 ----
29  mininet> net
30  h11 h11-eth0:s1-eth1
31  h12 h12-eth0:s1-eth2
32  h21 h21-eth0:s2-eth1
33  h22 h22-eth0:s2-eth2
34  h23 h23-eth0:s2-eth3
35  srvc1 srvc1-eth0:s3-eth3 srvc1-eth1:s4-eth3
36  srvc2 srvc2-eth0:s3-eth4 srvc2-eth1:s4-eth4
37  s1 lo:  s1-eth1:h11-eth0 s1-eth2:h12-eth0 s1-eth3:s2-eth4 s1-eth4:s3-eth2
38  s2 lo:  s2-eth1:h21-eth0 s2-eth2:h22-eth0 s2-eth3:h23-eth0 s2-eth4:s1-eth3 s2-eth5:s4-eth1
39  s3 lo:  s3-eth1:s4-eth2 s3-eth2:s1-eth4 s3-eth3:srvc1-eth0 s3-eth4:srvc2-eth0
40  s4 lo:  s4-eth1:s2-eth5 s4-eth2:s3-eth1 s4-eth3:srvc1-eth1 s4-eth4:srvc2-eth1
41 ----
42
43 ===== Configurations
44
45 ====== Mininet
46
47 * Please follow the below steps to configure the network in mininet as in the below image:
48
49 .Mininet Configuration
50 image::vtn/Mininet_Configuration.png["Mininet Configuration",width=500]
51
52 ====== Configure service nodes
53
54 * Please execute the following commands in the mininet console where mininet script is executed.
55
56 ----
57  mininet> srvc1 ip addr del 10.0.0.6/8 dev srvc1-eth0
58  mininet> srvc1 brctl addbr br0
59  mininet> srvc1 brctl addif br0 srvc1-eth0
60  mininet> srvc1 brctl addif br0 srvc1-eth1
61  mininet> srvc1 ifconfig br0 up
62  mininet> srvc1 tc qdisc add dev srvc1-eth1 root netem delay 200ms
63  mininet> srvc2 ip addr del 10.0.0.7/8 dev srvc2-eth0
64  mininet> srvc2 brctl addbr br0
65  mininet> srvc2 brctl addif br0 srvc2-eth0
66  mininet> srvc2 brctl addif br0 srvc2-eth1
67  mininet> srvc2 ifconfig br0 up
68  mininet> srvc2 tc qdisc add dev srvc2-eth1 root netem delay 300ms
69 ----
70
71 ===== Controller
72
73 ====== Multi-Tenancy
74
75 * Please execute the below commands to configure the network topology in the controller as in the below image:
76
77 .Tenant2
78 image::vtn/Tenant2.png["Tenant2",width=500]
79
80 ====== Please execute the below commands in controller
81
82 NOTE:
83 The below commands are for the difference in behavior of Manager in Beryllium topology. The Link below has the details for this bug: https://bugs.opendaylight.org/show_bug.cgi?id=3818.
84
85 ----
86 curl --user admin:admin -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X PUT http://localhost:8181/restconf/config/vtn-static-topology:vtn-static-topology/static-edge-ports -d '{"static-edge-ports": {"static-edge-port": [ {"port": "openflow:3:3"}, {"port": "openflow:3:4"}, {"port": "openflow:4:3"}, {"port": "openflow:4:4"}]}}'
87 ----
88
89 * Create a virtual tenant named vtn1 by executing
90   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn[the update-vtn RPC].
91
92 ----
93 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"vtn1","update-mode":"CREATE","operation":"SET","description":"creating vtn","idle-timeout":300,"hard-timeout":0}}'
94 ----
95
96 * Create a virtual bridge named vbr1 in the tenant vtn1 by executing
97   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge[the update-vbridge RPC].
98
99 ----
100 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vbridge:update-vbridge -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"creating vbr","tenant-name":"vtn1","bridge-name":"vbr1"}}'
101 ----
102
103 * Create interface if1 into the virtual bridge vbr1 by executing
104   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
105
106 ----
107 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vbrif1 interface","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1"}}'
108 ----
109
110 * Configure port mapping on the interface by executing
111   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
112
113 ** The interface if1 of the virtual bridge will be mapped to the port "s1-eth2" of the switch "openflow:1" of the Mininet.
114
115 *** The h12 is connected to the port "s1-eth2".
116
117 ----
118 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"vlan-id":0,"tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1","node":"openflow:1","port-name":"s1-eth2"}}'
119 ----
120
121 * Create interface if2 into the virtual bridge vbr1 by executing
122   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
123
124 ----
125 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vbrif2 interface","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if2"}}'
126 ----
127
128 * Configure port mapping on the interface by executing
129   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
130
131 ** The interface if2 of the virtual bridge will be mapped to the port "s2-eth2" of the switch "openflow:2" of the Mininet.
132
133 *** The h22 is connected to the port "s2-eth2".
134
135 ----
136 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"vlan-id":0,"tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if2","node":"openflow:2","port-name":"s2-eth2"}}'
137 ----
138
139 * Create interface if3 into the virtual bridge vbr1 by executing
140   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
141
142 ----
143 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vbrif3 interface","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if3"}}'
144 ----
145
146 * Configure port mapping on the interfaces by executing
147   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
148
149 ** The interface if3 of the virtual bridge will be mapped to the port "s2-eth3" of the switch "openflow:2" of the Mininet.
150
151 *** The h23 is connected to the port "s2-eth3".
152
153 ----
154 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"vlan-id":0,"tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if3","node":"openflow:2","port-name":"s2-eth3"}}'
155 ----
156
157 ===== Traffic filtering
158
159 * Create flowcondition named cond_1 by executing
160   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition[the set-flow-condition RPC].
161
162 ** For option source and destination-network, get inet address of host h12(src) and h22(dst) from mininet.
163
164 ----
165 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_1","vtn-flow-match":[{"index":1,"vtn-ether-match":{},"vtn-inet-match":{"source-network":"10.0.0.2/32","destination-network":"10.0.0.4/32"}}]}}'
166 ----
167
168 * Flow filter demonstration with DROP action-type. Create Flowfilter in VBR Interface if1 by executing
169   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter[the set-flow-filter RPC].
170
171 ----
172 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1","vtn-flow-filter":[{"condition":"cond_1","index":10,"vtn-drop-filter":{}}]}}'
173 ----
174
175 ===== Service Chaining
176
177 ====== With One Service
178
179 * Please execute the below commands to configure the network topology which sends some specific traffic via a single service(External device) in the controller as in the below image:
180
181 .Service Chaining With One Service LLD
182 image::vtn/Service_Chaining_With_One_Service_LLD.png["Service Chaining With One Service LLD",width=500]
183
184 * Create a virtual terminal named vt_srvc1_1 in the tenant vtn1 by executing
185   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal[the update-vterminal RPC].
186
187 ----
188 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc1_1","description":"Creating vterminal"}}'
189 ----
190
191 * Create interface IF into the virtual terminal vt_srvc1_1 by executing
192   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
193
194 ----
195 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc1_1","interface-name":"IF"}}'
196 ----
197
198 * Configure port mapping on the interfaces by executing
199   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
200
201 ** The interface IF of the virtual terminal will be mapped to the port "s3-eth3" of the switch "openflow:3" of the Mininet.
202
203 *** The h12 is connected to the port "s3-eth3".
204
205 ----
206 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"tenant-name":"vtn1","terminal-name":"vt_srvc1_1","interface-name":"IF","node":"openflow:3","port-name":"s3-eth3"}}'
207 ----
208
209 * Create a virtual terminal named vt_srvc1_2 in the tenant vtn1 by executing
210   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal[the update-vterminal RPC].
211
212 ----
213 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","description":"Creating vterminal"}}'
214 ----
215
216 * Create interface IF into the virtual terminal vt_srvc1_2 by executing
217   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
218
219 ----
220 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","interface-name":"IF"}}'
221 ----
222
223 * Configure port mapping on the interfaces by executing
224   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
225
226 ** The interface IF of the virtual terminal will be mapped to the port "s4-eth3" of the switch "openflow:4" of the Mininet.
227
228 *** The h22 is connected to the port "s4-eth3".
229
230 ----
231 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"tenant-name":"vtn1","terminal-name":"vt_srvc1_2","interface-name":"IF","node":"openflow:4","port-name":"s4-eth3"}}'
232 ----
233
234 * Create flowcondition named cond_1 by executing
235   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition[the set-flow-condition RPC].
236
237 ** For option source and destination-network, get inet address of host h12(src) and h22(dst) from mininet.
238
239 ----
240 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_1","vtn-flow-match":[{"index":1,"vtn-ether-match":{},"vtn-inet-match":{"source-network":"10.0.0.2/32","destination-network":"10.0.0.4/32"}}]}}'
241 ----
242
243 * Create flowcondition named cond_any by executing
244   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition[the set-flow-condition RPC].
245
246 ----
247 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_any","vtn-flow-match":[{"index":1}]}}'
248 ----
249
250 * Flow filter demonstration with redirect action-type. Create Flowfilter in virtual terminal vt_srvc1_2 interface IF by executing
251   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter[the set-flow-filter RPC].
252
253 ** Flowfilter redirects vt_srvc1_2 to bridge1-IF2
254
255 ----
256 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","interface-name":"IF","vtn-flow-filter":[{"condition":"cond_any","index":10,"vtn-redirect-filter":{"redirect-destination":{"bridge-name":"vbr1","interface-name":"if2"},"output":"true"}}]}}'
257 ----
258
259 * Flow filter demonstration with redirect action-type. Create Flowfilter in vbridge vbr1 interface if1 by executing
260   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter[the set-flow-filter RPC].
261
262 ** Flow filter redirects Bridge1-IF1 to vt_srvc1_1
263
264 ----
265 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1","vtn-flow-filter":[{"condition":"cond_1","index":10,"vtn-redirect-filter":{"redirect-destination":{"terminal-name":"vt_srvc1_1","interface-name":"IF"},"output":"true"}}]}}'
266 ----
267
268 ===== Verification
269
270 .Service Chaining With One Service
271 image::vtn/Service_Chaining_With_One_Service_Verification.png["Service Chaining With One Service Verification",width=500]
272
273 * Ping host12 to host22 to view the host rechability, a delay of 200ms will be taken to reach host22 as below.
274
275 ----
276  mininet> h12 ping h22
277  PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
278  64 bytes from 10.0.0.4: icmp_seq=35 ttl=64 time=209 ms
279  64 bytes from 10.0.0.4: icmp_seq=36 ttl=64 time=201 ms
280  64 bytes from 10.0.0.4: icmp_seq=37 ttl=64 time=200 ms
281  64 bytes from 10.0.0.4: icmp_seq=38 ttl=64 time=200 ms
282 ----
283
284 ====== With two services
285
286 * Please execute the below commands to configure the network topology which sends some specific traffic via two services(External device) in the controller as in the below image.
287
288 .Service Chaining With Two Services LLD
289 image::vtn/Service_Chaining_With_Two_Services_LLD.png["Service Chaining With Two Services LLD",width=500]
290
291 * Create a virtual terminal named vt_srvc2_1 in the tenant vtn1 by executing
292   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal[the update-vterminal RPC].
293
294 ----
295 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc2_1","description":"Creating vterminal"}}'
296 ----
297
298 * Create interface IF into the virtual terminal vt_srvc2_1 by executing
299   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
300
301 ----
302 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc2_1","interface-name":"IF"}}'
303 ----
304
305 * Configure port mapping on the interfaces by executing
306   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
307
308 ** The interface IF of the virtual terminal will be mapped to the port "s3-eth4" of the switch "openflow:3" of the Mininet.
309
310 *** The host h12 is connected to the port "s3-eth4".
311
312 ----
313 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"tenant-name":"vtn1","terminal-name":"vt_srvc2_1","interface-name":"IF","node":"openflow:3","port-name":"s3-eth4"}}'
314 ----
315
316 * Create a virtual terminal named vt_srvc2_2 in the tenant vtn1 by executing
317   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal[the update-vterminal RPC].
318
319 ----
320 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc2_2","description":"Creating vterminal"}}'
321 ----
322
323 * Create interfaces IF into the virtual terminal vt_srvc2_2 by executing
324   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
325
326 ----
327 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc2_2","interface-name":"IF"}}'
328 ----
329
330 * Configure port mapping on the interfaces by executing
331   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
332
333 ** The interface IF of the virtual terminal will be mapped to the port "s4-eth4" of the switch "openflow:4" of the mininet.
334
335 *** The host h22 is connected to the port "s4-eth4".
336
337 ----
338 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"tenant-name":"vtn1","terminal-name":"vt_srvc2_2","interface-name":"IF","node":"openflow:4","port-name":"s4-eth4"}}'
339 ----
340
341 * Flow filter demonstration with redirect action-type. Create Flowfilter in virtual terminal vt_srvc2_2 interface IF by executing
342   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter[the set-flow-filter RPC].
343
344 ** Flow filter redirects vt_srvc2_2 to Bridge1-IF2.
345
346 ----
347 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","terminal-name":"vt_srvc2_2","interface-name":"IF","vtn-flow-filter":[{"condition":"cond_any","index":10,"vtn-redirect-filter":{"redirect-destination":{"bridge-name":"vbr1","interface-name":"if2"},"output":"true"}}]}}'
348 ----
349
350 * Flow filter demonstration with redirect action-type. Create Flowfilter in virtual terminal vt_srvc2_2 interface IF by executing
351   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter[the set-flow-filter RPC].
352
353 ** Flow filter redirects vt_srvc1_2 to vt_srvc2_1.
354
355 ----
356 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","interface-name":"IF","vtn-flow-filter":[{"condition":"cond_any","index":10,"vtn-redirect-filter":{"redirect-destination":{"terminal-name":"vt_srvc2_1","interface-name":"IF"},"output":"true"}}]}}'
357 ----
358
359 ===== Verification
360
361 .Service Chaining With Two Service
362 image::vtn/Service_Chaining_With_Two_Services.png["Service Chaining With Two Services",width=500]
363
364 * Ping host12 to host22 to view the host rechability, a delay of 500ms will be taken to reach host22 as below.
365
366 ----
367  mininet> h12 ping h22
368  PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
369  64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=512 ms
370  64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=501 ms
371  64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=500 ms
372  64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=500 ms
373 ----
374
375 * You can verify the configuration by executing the following REST API. It shows all configuration in VTN Manager.
376
377 ----
378 curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns
379 ----
380
381 ----
382 {
383   "vtn": [
384   {
385     "name": "vtn1",
386       "vtenant-config": {
387         "hard-timeout": 0,
388         "idle-timeout": 300,
389         "description": "creating vtn"
390       },
391       "vbridge": [
392       {
393         "name": "vbr1",
394         "vbridge-config": {
395           "age-interval": 600,
396           "description": "creating vbr"
397         },
398         "bridge-status": {
399           "state": "UP",
400           "path-faults": 0
401         },
402         "vinterface": [
403         {
404           "name": "if1",
405           "vinterface-status": {
406             "mapped-port": "openflow:1:2",
407             "state": "UP",
408             "entity-state": "UP"
409           },
410           "port-map-config": {
411             "vlan-id": 0,
412             "node": "openflow:1",
413             "port-name": "s1-eth2"
414           },
415           "vinterface-config": {
416             "description": "Creating vbrif1 interface",
417             "enabled": true
418           },
419           "vinterface-input-filter": {
420             "vtn-flow-filter": [
421             {
422               "index": 10,
423               "condition": "cond_1",
424               "vtn-redirect-filter": {
425                 "output": true,
426                 "redirect-destination": {
427                   "terminal-name": "vt_srvc1_1",
428                   "interface-name": "IF"
429                 }
430               }
431             }
432             ]
433           }
434         },
435         {
436           "name": "if2",
437           "vinterface-status": {
438             "mapped-port": "openflow:2:2",
439             "state": "UP",
440             "entity-state": "UP"
441           },
442           "port-map-config": {
443             "vlan-id": 0,
444             "node": "openflow:2",
445             "port-name": "s2-eth2"
446           },
447           "vinterface-config": {
448             "description": "Creating vbrif2 interface",
449             "enabled": true
450           }
451         },
452         {
453           "name": "if3",
454           "vinterface-status": {
455             "mapped-port": "openflow:2:3",
456             "state": "UP",
457             "entity-state": "UP"
458           },
459           "port-map-config": {
460             "vlan-id": 0,
461             "node": "openflow:2",
462             "port-name": "s2-eth3"
463           },
464           "vinterface-config": {
465             "description": "Creating vbrif3 interface",
466             "enabled": true
467           }
468         }
469         ]
470       }
471     ],
472       "vterminal": [
473       {
474         "name": "vt_srvc2_2",
475         "bridge-status": {
476           "state": "UP",
477           "path-faults": 0
478         },
479         "vinterface": [
480         {
481           "name": "IF",
482           "vinterface-status": {
483             "mapped-port": "openflow:4:4",
484             "state": "UP",
485             "entity-state": "UP"
486           },
487           "port-map-config": {
488             "vlan-id": 0,
489             "node": "openflow:4",
490             "port-name": "s4-eth4"
491           },
492           "vinterface-config": {
493             "description": "Creating vterminal IF",
494             "enabled": true
495           },
496           "vinterface-input-filter": {
497             "vtn-flow-filter": [
498             {
499               "index": 10,
500               "condition": "cond_any",
501               "vtn-redirect-filter": {
502                 "output": true,
503                 "redirect-destination": {
504                   "bridge-name": "vbr1",
505                   "interface-name": "if2"
506                 }
507               }
508             }
509             ]
510           }
511         }
512         ],
513           "vterminal-config": {
514             "description": "Creating vterminal"
515           }
516       },
517       {
518         "name": "vt_srvc1_1",
519         "bridge-status": {
520           "state": "UP",
521           "path-faults": 0
522         },
523         "vinterface": [
524         {
525           "name": "IF",
526           "vinterface-status": {
527             "mapped-port": "openflow:3:3",
528             "state": "UP",
529             "entity-state": "UP"
530           },
531           "port-map-config": {
532             "vlan-id": 0,
533             "node": "openflow:3",
534             "port-name": "s3-eth3"
535           },
536           "vinterface-config": {
537             "description": "Creating vterminal IF",
538             "enabled": true
539           }
540         }
541         ],
542           "vterminal-config": {
543             "description": "Creating vterminal"
544           }
545       },
546       {
547         "name": "vt_srvc1_2",
548         "bridge-status": {
549           "state": "UP",
550           "path-faults": 0
551         },
552         "vinterface": [
553         {
554           "name": "IF",
555           "vinterface-status": {
556             "mapped-port": "openflow:4:3",
557             "state": "UP",
558             "entity-state": "UP"
559           },
560           "port-map-config": {
561             "vlan-id": 0,
562             "node": "openflow:4",
563             "port-name": "s4-eth3"
564           },
565           "vinterface-config": {
566             "description": "Creating vterminal IF",
567             "enabled": true
568           },
569           "vinterface-input-filter": {
570             "vtn-flow-filter": [
571             {
572               "index": 10,
573               "condition": "cond_any",
574               "vtn-redirect-filter": {
575                 "output": true,
576                 "redirect-destination": {
577                   "terminal-name": "vt_srvc2_1",
578                   "interface-name": "IF"
579                 }
580               }
581             }
582             ]
583           }
584         }
585         ],
586           "vterminal-config": {
587             "description": "Creating vterminal"
588           }
589       },
590       {
591         "name": "vt_srvc2_1",
592         "bridge-status": {
593           "state": "UP",
594           "path-faults": 0
595         },
596         "vinterface": [
597         {
598           "name": "IF",
599           "vinterface-status": {
600             "mapped-port": "openflow:3:4",
601             "state": "UP",
602             "entity-state": "UP"
603           },
604           "port-map-config": {
605             "vlan-id": 0,
606             "node": "openflow:3",
607             "port-name": "s3-eth4"
608           },
609           "vinterface-config": {
610             "description": "Creating vterminal IF",
611             "enabled": true
612           }
613         }
614         ],
615           "vterminal-config": {
616             "description": "Creating vterminal"
617           }
618       }
619     ]
620   }
621   ]
622 }
623 ----
624
625 ===== Cleaning Up
626
627 * To clean up both VTN and flowconditions.
628
629 * You can delete the virtual tenant vtn1 by executing
630   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn[the remove-vtn RPC].
631
632 ----
633 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'
634 ----
635
636 * You can delete the flowcondition cond_1 and cond_any by executing
637   https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#remove-flow-condition[the remove-flow-condition RPC].
638
639 ----
640 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:remove-flow-condition -d '{"input":{"name":"cond_1"}}'
641 ----
642
643
644 ----
645 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:remove-flow-condition -d '{"input":{"name":"cond_any"}}'
646 ----
647