ovn: Add a section on containers in OVN Tutorial
[cascardo/ovs.git] / tutorial / ovn / env7 / add-container-ports.sh
1 #!/bin/bash
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15
16 set -o xtrace
17
18 # create a logical switch
19 ovn-nbctl lswitch-add csw0
20
21 # create a container port with parent set to sw0-port1
22 ovn-nbctl lport-add csw0 csw0-cport1 sw0-port1 42
23 ovn-nbctl lport-set-addresses csw0-cport1 00:00:00:00:01:01
24 ovn-nbctl lport-set-port-security csw0-cport1 00:00:00:00:01:01
25
26 # create another container port with parent set to sw0-port1
27 ovn-nbctl lport-add csw0 csw0-cport2 sw0-port2 43
28 ovn-nbctl lport-set-addresses csw0-cport2 00:00:00:00:01:02
29 ovn-nbctl lport-set-port-security csw0-cport2 00:00:00:00:01:02
30
31
32 # Make lport1 as a patch port, other end connected to br-vmport1
33 ovs-vsctl set interface lport1 type=patch
34 ovs-vsctl set interface lport1 options:peer=patch-lport1
35
36 ovs-vsctl set interface lport2 type=patch
37 ovs-vsctl set interface lport2 options:peer=patch-lport2
38
39
40 # This represents ovs bridge inside a VM attached to lport1
41 ovs-vsctl add-br br-vmport1
42
43 # create a patch port with peer set to lport1.
44 ovs-vsctl add-port br-vmport1 patch-lport1
45 ovs-vsctl set interface patch-lport1 type=patch
46 ovs-vsctl set interface patch-lport1 options:peer=lport1
47
48 # create a container port on br-vmport1. Any traffic sent on this
49 # port will reach to the br-int of the host via the patch port
50 ovs-vsctl add-port br-vmport1 cport1
51 ovs-vsctl set port cport1 tag=42
52
53 # This represents ovs bridge inside a VM attached to lport2
54 ovs-vsctl add-br br-vmport2
55 ovs-vsctl add-port br-vmport2 patch-lport2
56 ovs-vsctl set interface patch-lport2 type=patch
57 ovs-vsctl set interface patch-lport2 options:peer=lport2
58
59 ovs-vsctl add-port br-vmport2 cport2
60 ovs-vsctl set port cport2 tag=43