VTN Beryllium - Adoc changes.
[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 ====== Install flow entries
53
54 * In mininet environment, install the following flow entries to send PACKET_IN to the controller.
55
56 ----
57  $ sudo ovs-ofctl add-flow s1 priority=0,actions=output:CONTROLLER
58  $ sudo ovs-ofctl add-flow s2 priority=0,actions=output:CONTROLLER
59  $ sudo ovs-ofctl add-flow s3 priority=0,actions=output:CONTROLLER
60  $ sudo ovs-ofctl add-flow s4 priority=0,actions=output:CONTROLLER
61 ----
62
63 ====== Configure service nodes
64
65 * Please execute the following commands in the mininet console where mininet script is executed.
66
67 ----
68  mininet> srvc1 ip addr del 10.0.0.6/8 dev srvc1-eth0
69  mininet> srvc1 brctl addbr br0
70  mininet> srvc1 brctl addif br0 srvc1-eth0
71  mininet> srvc1 brctl addif br0 srvc1-eth1
72  mininet> srvc1 ifconfig br0 up
73  mininet> srvc1 tc qdisc add dev srvc1-eth1 root netem delay 200ms
74  mininet> srvc2 ip addr del 10.0.0.7/8 dev srvc2-eth0
75  mininet> srvc2 brctl addbr br0
76  mininet> srvc2 brctl addif br0 srvc2-eth0
77  mininet> srvc2 brctl addif br0 srvc2-eth1
78  mininet> srvc2 ifconfig br0 up
79  mininet> srvc2 tc qdisc add dev srvc2-eth1 root netem delay 300ms
80 ----
81
82 ===== Controller
83
84 ====== Multi-Tenancy
85
86 * Please execute the below commands to configure the network topology in the controller as in the below image:
87
88 .Tenant2
89 image::vtn/Tenant2.png["Tenant2",width=500]
90
91 ====== Please execute the below commands in controller
92
93 NOTE:
94 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.
95
96 ----
97 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"}]}}'
98 ----
99
100 * Create a virtual tenant named vtn1 by executing
101   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].
102
103 ----
104 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}}'
105 ----
106
107 * Create a virtual bridge named vbr1 in the tenant vtn1 by executing
108   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].
109
110 ----
111 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"}}'
112 ----
113
114 * Create interface if1 into the virtual bridge vbr1 by executing
115   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].
116
117 ----
118 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"}}'
119 ----
120
121 * Configure port mapping on the interface by executing
122   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].
123
124 ** The interface if1 of the virtual bridge will be mapped to the port "s1-eth2" of the switch "openflow:1" of the Mininet.
125
126 *** The h12 is connected to the port "s1-eth2".
127
128 ----
129 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"}}'
130 ----
131
132 * Create interface if2 into the virtual bridge vbr1 by executing
133   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].
134
135 ----
136 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"}}'
137 ----
138
139 * Configure port mapping on the interface by executing
140   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].
141
142 ** The interface if2 of the virtual bridge will be mapped to the port "s2-eth2" of the switch "openflow:2" of the Mininet.
143
144 *** The h22 is connected to the port "s2-eth2".
145
146 ----
147 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"}}'
148 ----
149
150 * Create interface if3 into the virtual bridge vbr1 by executing
151   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].
152
153 ----
154 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"}}'
155 ----
156
157 * Configure port mapping on the interfaces by executing
158   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].
159
160 ** The interface if3 of the virtual bridge will be mapped to the port "s2-eth3" of the switch "openflow:2" of the Mininet.
161
162 *** The h23 is connected to the port "s2-eth3".
163
164 ----
165 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"}}'
166 ----
167
168 ===== Traffic filtering
169
170 * Create flowcondition named cond_1 by executing
171   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].
172
173 ** For option source and destination-network, get inet address of host h12(src) and h22(dst) from mininet.
174
175 ----
176 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"}}]}}'
177 ----
178
179 * Flow filter demonstration with DROP action-type. Create Flowfilter in VBR Interface if1 by executing
180   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].
181
182 ----
183 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":{}}]}}'
184 ----
185
186 ===== Service Chaining
187
188 ====== With One Service
189
190 * 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:
191
192 .Service Chaining With One Service LLD
193 image::vtn/Service_Chaining_With_One_Service_LLD.png["Service Chaining With One Service LLD",width=500]
194
195 * Create a virtual terminal named vt_srvc1_1 in the tenant vtn1 by executing
196   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].
197
198 ----
199 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"}}'
200 ----
201
202 * Create interface IF into the virtual terminal vt_srvc1_1 by executing
203   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].
204
205 ----
206 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"}}'
207 ----
208
209 * Configure port mapping on the interfaces by executing
210   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].
211
212 ** The interface IF of the virtual terminal will be mapped to the port "s3-eth3" of the switch "openflow:3" of the Mininet.
213
214 *** The h12 is connected to the port "s3-eth3".
215
216 ----
217 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"}}'
218 ----
219
220 * Create a virtual terminal named vt_srvc1_2 in the tenant vtn1 by executing
221   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].
222
223 ----
224 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"}}'
225 ----
226
227 * Create interface IF into the virtual terminal vt_srvc1_2 by executing
228   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].
229
230 ----
231 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"}}'
232 ----
233
234 * Configure port mapping on the interfaces by executing
235   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].
236
237 ** The interface IF of the virtual terminal will be mapped to the port "s4-eth3" of the switch "openflow:4" of the Mininet.
238
239 *** The h22 is connected to the port "s4-eth3".
240
241 ----
242 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"}}'
243 ----
244
245 * Create flowcondition named cond_1 by executing
246   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].
247
248 ** For option source and destination-network, get inet address of host h12(src) and h22(dst) from mininet.
249
250 ----
251 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"}}]}}'
252 ----
253
254 * Create flowcondition named cond_any by executing
255   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].
256
257 ----
258 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}]}}'
259 ----
260
261 * Flow filter demonstration with redirect action-type. Create Flowfilter in virtual terminal vt_srvc1_2 interface IF by executing
262   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].
263
264 ** Flowfilter redirects vt_srvc1_2 to bridge1-IF2
265
266 ----
267 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"}}]}}'
268 ----
269
270 * Flow filter demonstration with redirect action-type. Create Flowfilter in vbridge vbr1 interface if1 by executing
271   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].
272
273 ** Flow filter redirects Bridge1-IF1 to vt_srvc1_1
274
275 ----
276 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"}}]}}'
277 ----
278
279 ===== Verification
280
281 .Service Chaining With One Service
282 image::vtn/Service_Chaining_With_One_Service_Verification.png["Service Chaining With One Service Verification",width=500]
283
284 * Ping host12 to host22 to view the host rechability, a delay of 200ms will be taken to reach host22 as below.
285
286 ----
287  mininet> h12 ping h22
288  PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
289  64 bytes from 10.0.0.4: icmp_seq=35 ttl=64 time=209 ms
290  64 bytes from 10.0.0.4: icmp_seq=36 ttl=64 time=201 ms
291  64 bytes from 10.0.0.4: icmp_seq=37 ttl=64 time=200 ms
292  64 bytes from 10.0.0.4: icmp_seq=38 ttl=64 time=200 ms
293 ----
294
295 ====== With two services
296
297 * 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.
298
299 .Service Chaining With Two Services LLD
300 image::vtn/Service_Chaining_With_Two_Services_LLD.png["Service Chaining With Two Services LLD",width=500]
301
302 * Create a virtual terminal named vt_srvc2_1 in the tenant vtn1 by executing
303   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].
304
305 ----
306 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"}}'
307 ----
308
309 * Create interface IF into the virtual terminal vt_srvc2_1 by executing
310   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].
311
312 ----
313 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"}}'
314 ----
315
316 * Configure port mapping on the interfaces by executing
317   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].
318
319 ** The interface IF of the virtual terminal will be mapped to the port "s3-eth4" of the switch "openflow:3" of the Mininet.
320
321 *** The host h12 is connected to the port "s3-eth4".
322
323 ----
324 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"}}'
325 ----
326
327 * Create a virtual terminal named vt_srvc2_2 in the tenant vtn1 by executing
328   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].
329
330 ----
331 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"}}'
332 ----
333
334 * Create interfaces IF into the virtual terminal vt_srvc2_2 by executing
335   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].
336
337 ----
338 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"}}'
339 ----
340
341 * Configure port mapping on the interfaces by executing
342   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].
343
344 ** The interface IF of the virtual terminal will be mapped to the port "s4-eth4" of the switch "openflow:4" of the mininet.
345
346 *** The host h22 is connected to the port "s4-eth4".
347
348 ----
349 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"}}'
350 ----
351
352 * Flow filter demonstration with redirect action-type. Create Flowfilter in virtual terminal vt_srvc2_2 interface IF by executing
353   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].
354
355 ** Flow filter redirects vt_srvc2_2 to Bridge1-IF2.
356
357 ----
358 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"}}]}}'
359 ----
360
361 * Flow filter demonstration with redirect action-type. Create Flowfilter in virtual terminal vt_srvc2_2 interface IF by executing
362   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].
363
364 ** Flow filter redirects vt_srvc1_2 to vt_srvc2_1.
365
366 ----
367 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"}}]}}'
368 ----
369
370 ===== Verification
371
372 .Service Chaining With Two Service
373 image::vtn/Service_Chaining_With_Two_Services.png["Service Chaining With Two Services",width=500]
374
375 * Ping host12 to host22 to view the host rechability, a delay of 500ms will be taken to reach host22 as below.
376
377 ----
378  mininet> h12 ping h22
379  PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
380  64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=512 ms
381  64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=501 ms
382  64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=500 ms
383  64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=500 ms
384 ----
385
386 * You can verify the configuration by executing the following REST API. It shows all configuration in VTN Manager.
387
388 ----
389 curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns
390 ----
391
392 ----
393 {
394   "vtn": [
395   {
396     "name": "vtn1",
397       "vtenant-config": {
398         "hard-timeout": 0,
399         "idle-timeout": 300,
400         "description": "creating vtn"
401       },
402       "vbridge": [
403       {
404         "name": "vbr1",
405         "vbridge-config": {
406           "age-interval": 600,
407           "description": "creating vbr"
408         },
409         "bridge-status": {
410           "state": "UP",
411           "path-faults": 0
412         },
413         "vinterface": [
414         {
415           "name": "if1",
416           "vinterface-status": {
417             "mapped-port": "openflow:1:2",
418             "state": "UP",
419             "entity-state": "UP"
420           },
421           "port-map-config": {
422             "vlan-id": 0,
423             "node": "openflow:1",
424             "port-name": "s1-eth2"
425           },
426           "vinterface-config": {
427             "description": "Creating vbrif1 interface",
428             "enabled": true
429           },
430           "vinterface-input-filter": {
431             "vtn-flow-filter": [
432             {
433               "index": 10,
434               "condition": "cond_1",
435               "vtn-redirect-filter": {
436                 "output": true,
437                 "redirect-destination": {
438                   "terminal-name": "vt_srvc1_1",
439                   "interface-name": "IF"
440                 }
441               }
442             }
443             ]
444           }
445         },
446         {
447           "name": "if2",
448           "vinterface-status": {
449             "mapped-port": "openflow:2:2",
450             "state": "UP",
451             "entity-state": "UP"
452           },
453           "port-map-config": {
454             "vlan-id": 0,
455             "node": "openflow:2",
456             "port-name": "s2-eth2"
457           },
458           "vinterface-config": {
459             "description": "Creating vbrif2 interface",
460             "enabled": true
461           }
462         },
463         {
464           "name": "if3",
465           "vinterface-status": {
466             "mapped-port": "openflow:2:3",
467             "state": "UP",
468             "entity-state": "UP"
469           },
470           "port-map-config": {
471             "vlan-id": 0,
472             "node": "openflow:2",
473             "port-name": "s2-eth3"
474           },
475           "vinterface-config": {
476             "description": "Creating vbrif3 interface",
477             "enabled": true
478           }
479         }
480         ]
481       }
482     ],
483       "vterminal": [
484       {
485         "name": "vt_srvc2_2",
486         "bridge-status": {
487           "state": "UP",
488           "path-faults": 0
489         },
490         "vinterface": [
491         {
492           "name": "IF",
493           "vinterface-status": {
494             "mapped-port": "openflow:4:4",
495             "state": "UP",
496             "entity-state": "UP"
497           },
498           "port-map-config": {
499             "vlan-id": 0,
500             "node": "openflow:4",
501             "port-name": "s4-eth4"
502           },
503           "vinterface-config": {
504             "description": "Creating vterminal IF",
505             "enabled": true
506           },
507           "vinterface-input-filter": {
508             "vtn-flow-filter": [
509             {
510               "index": 10,
511               "condition": "cond_any",
512               "vtn-redirect-filter": {
513                 "output": true,
514                 "redirect-destination": {
515                   "bridge-name": "vbr1",
516                   "interface-name": "if2"
517                 }
518               }
519             }
520             ]
521           }
522         }
523         ],
524           "vterminal-config": {
525             "description": "Creating vterminal"
526           }
527       },
528       {
529         "name": "vt_srvc1_1",
530         "bridge-status": {
531           "state": "UP",
532           "path-faults": 0
533         },
534         "vinterface": [
535         {
536           "name": "IF",
537           "vinterface-status": {
538             "mapped-port": "openflow:3:3",
539             "state": "UP",
540             "entity-state": "UP"
541           },
542           "port-map-config": {
543             "vlan-id": 0,
544             "node": "openflow:3",
545             "port-name": "s3-eth3"
546           },
547           "vinterface-config": {
548             "description": "Creating vterminal IF",
549             "enabled": true
550           }
551         }
552         ],
553           "vterminal-config": {
554             "description": "Creating vterminal"
555           }
556       },
557       {
558         "name": "vt_srvc1_2",
559         "bridge-status": {
560           "state": "UP",
561           "path-faults": 0
562         },
563         "vinterface": [
564         {
565           "name": "IF",
566           "vinterface-status": {
567             "mapped-port": "openflow:4:3",
568             "state": "UP",
569             "entity-state": "UP"
570           },
571           "port-map-config": {
572             "vlan-id": 0,
573             "node": "openflow:4",
574             "port-name": "s4-eth3"
575           },
576           "vinterface-config": {
577             "description": "Creating vterminal IF",
578             "enabled": true
579           },
580           "vinterface-input-filter": {
581             "vtn-flow-filter": [
582             {
583               "index": 10,
584               "condition": "cond_any",
585               "vtn-redirect-filter": {
586                 "output": true,
587                 "redirect-destination": {
588                   "terminal-name": "vt_srvc2_1",
589                   "interface-name": "IF"
590                 }
591               }
592             }
593             ]
594           }
595         }
596         ],
597           "vterminal-config": {
598             "description": "Creating vterminal"
599           }
600       },
601       {
602         "name": "vt_srvc2_1",
603         "bridge-status": {
604           "state": "UP",
605           "path-faults": 0
606         },
607         "vinterface": [
608         {
609           "name": "IF",
610           "vinterface-status": {
611             "mapped-port": "openflow:3:4",
612             "state": "UP",
613             "entity-state": "UP"
614           },
615           "port-map-config": {
616             "vlan-id": 0,
617             "node": "openflow:3",
618             "port-name": "s3-eth4"
619           },
620           "vinterface-config": {
621             "description": "Creating vterminal IF",
622             "enabled": true
623           }
624         }
625         ],
626           "vterminal-config": {
627             "description": "Creating vterminal"
628           }
629       }
630     ]
631   }
632   ]
633 }
634 ----
635
636 ===== Cleaning Up
637
638 * To clean up both VTN and flowconditions.
639
640 * You can delete the virtual tenant vtn1 by executing
641   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].
642
643 ----
644 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'
645 ----
646
647 * You can delete the flowcondition cond_1 and cond_any by executing
648   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].
649
650 ----
651 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"}}'
652 ----
653
654
655 ----
656 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"}}'
657 ----
658