From 2b2f2b2ff1d98a6ae84928b3d83052427a01f5d0 Mon Sep 17 00:00:00 2001 From: nickcooper-zhangtonghao Date: Mon, 1 Aug 2016 00:57:01 -0700 Subject: ovn: improve OVN tutorial. Improve the tutorial of the basic OVN features. Update the contents of the "Locally attached networks" and "Locally attached networks with VLANs" in detail. The logical ports of type "l2gateway" is described. Submitted-at: https://github.com/openvswitch/ovs/pull/144 Signed-off-by: nickcooper-zhangtonghao Signed-off-by: Russell Bryant --- tutorial/ovn/env4/packet1.sh | 8 +++---- tutorial/ovn/env4/packet2.sh | 7 ++++--- tutorial/ovn/env4/packet3.sh | 4 +++- tutorial/ovn/env4/packet4.sh | 4 +++- tutorial/ovn/env4/packet5.sh | 18 ---------------- tutorial/ovn/env4/setup.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++ tutorial/ovn/env4/setup1.sh | 19 ----------------- tutorial/ovn/env4/setup2.sh | 47 ----------------------------------------- tutorial/ovn/env5/packet1.sh | 5 ++++- tutorial/ovn/env5/packet2.sh | 4 +++- tutorial/ovn/env8/packet1.sh | 21 +++++++++++++++++++ tutorial/ovn/env8/packet2.sh | 20 ++++++++++++++++++ tutorial/ovn/env8/setup.sh | 47 +++++++++++++++++++++++++++++++++++++++++ 13 files changed, 159 insertions(+), 95 deletions(-) delete mode 100755 tutorial/ovn/env4/packet5.sh create mode 100755 tutorial/ovn/env4/setup.sh delete mode 100755 tutorial/ovn/env4/setup1.sh delete mode 100755 tutorial/ovn/env4/setup2.sh create mode 100755 tutorial/ovn/env8/packet1.sh create mode 100755 tutorial/ovn/env8/packet2.sh create mode 100755 tutorial/ovn/env8/setup.sh (limited to 'tutorial/ovn') diff --git a/tutorial/ovn/env4/packet1.sh b/tutorial/ovn/env4/packet1.sh index ae158466d..7b23738af 100755 --- a/tutorial/ovn/env4/packet1.sh +++ b/tutorial/ovn/env4/packet1.sh @@ -15,7 +15,7 @@ set -o xtrace -# input from local vif, lport1 (ofport 3) -# destination MAC is lport 2 -# expect to go out via localnet port (ofport 1) -ovs-appctl ofproto/trace br-int in_port=3,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02 -generate +# input from local vif, lport1 (ofport 2) +# destination MAC is lport2 +# expect to go out via localnet port (ofport 3) and lport2 (ofport 4) +ovs-appctl ofproto/trace br-int in_port=2,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02 -generate diff --git a/tutorial/ovn/env4/packet2.sh b/tutorial/ovn/env4/packet2.sh index 51b473624..134056e88 100755 --- a/tutorial/ovn/env4/packet2.sh +++ b/tutorial/ovn/env4/packet2.sh @@ -15,6 +15,7 @@ set -o xtrace -# input from localnet port (ofport 1) -# expect to be delivered to local vif, lport2 (ofport 4) -ovs-appctl ofproto/trace br-int in_port=1,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02 -generate +# input from local vif, lport1 (ofport 2) +# destination MAC is on remote chassis +# expect to go out via localnet port (ofport 3) +ovs-appctl ofproto/trace br-int in_port=2,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:03 -generate diff --git a/tutorial/ovn/env4/packet3.sh b/tutorial/ovn/env4/packet3.sh index daf6c05bc..f90f2fc4d 100755 --- a/tutorial/ovn/env4/packet3.sh +++ b/tutorial/ovn/env4/packet3.sh @@ -15,4 +15,6 @@ set -o xtrace -ovs-appctl ofproto/trace br-int in_port=3,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:03 -generate +# input from local vif, lport1 (ofport 2) +# expect to go out via localnet port (ofport 3) and lport2 (ofport 4) +ovs-appctl ofproto/trace br-int in_port=2,dl_src=00:00:00:00:00:01,dl_dst=ff:ff:ff:ff:ff:ff -generate diff --git a/tutorial/ovn/env4/packet4.sh b/tutorial/ovn/env4/packet4.sh index 91c89e21e..be805bc72 100755 --- a/tutorial/ovn/env4/packet4.sh +++ b/tutorial/ovn/env4/packet4.sh @@ -15,4 +15,6 @@ set -o xtrace -ovs-appctl ofproto/trace br-int in_port=3,dl_src=00:00:00:00:00:01,dl_dst=ff:ff:ff:ff:ff:ff -generate +# We use the LOCAL port of br-eth1 to simulate the port connected to network. +# expect to arrive on lport1 (ofport 2) and lport2 (ofport 4) +ovs-appctl ofproto/trace br-eth1 in_port=LOCAL,dl_src=00:00:00:00:00:03,dl_dst=ff:ff:ff:ff:ff:ff -generate diff --git a/tutorial/ovn/env4/packet5.sh b/tutorial/ovn/env4/packet5.sh deleted file mode 100755 index e53c87303..000000000 --- a/tutorial/ovn/env4/packet5.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set -o xtrace - -ovs-appctl ofproto/trace br-int in_port=1,dl_src=00:00:00:00:00:03,dl_dst=ff:ff:ff:ff:ff:ff -generate diff --git a/tutorial/ovn/env4/setup.sh b/tutorial/ovn/env4/setup.sh new file mode 100755 index 000000000..03950f0a1 --- /dev/null +++ b/tutorial/ovn/env4/setup.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script simulates 2 chassis connected to a physical switch, +# which we call "physnet1". We have two logical ports, one on each hypervisor, +# that OVN will connect to physnet1. +# +# The way to accomplish this in OVN is to create a logical switch for each +# logical port. In addition to the normal logical port, each logical switch +# has a special "localnet" port, which represents the connection to physnet1. +# +# In this setup we see the view of this environment from one of the hypervisors. + +set -o xtrace + +ovs-vsctl add-br br-eth1 +ovs-vsctl set open . external-ids:ovn-bridge-mappings=physnet1:br-eth1 + +ovn-sbctl chassis-add fakechassis geneve 127.0.0.1 + +for n in 1 2 3 4; do + ovn-nbctl ls-add provnet1-$n + + ovn-nbctl lsp-add provnet1-$n provnet1-$n-port1 + ovn-nbctl lsp-set-addresses provnet1-$n-port1 00:00:00:00:00:0$n + ovn-nbctl lsp-set-port-security provnet1-$n-port1 00:00:00:00:00:0$n + + ovn-nbctl lsp-add provnet1-$n provnet1-$n-physnet1 + ovn-nbctl lsp-set-addresses provnet1-$n-physnet1 unknown + ovn-nbctl lsp-set-type provnet1-$n-physnet1 localnet + ovn-nbctl lsp-set-options provnet1-$n-physnet1 network_name=physnet1 +done + +ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1 +ovs-vsctl add-port br-int lport2 -- set Interface lport2 external_ids:iface-id=provnet1-2-port1 + +ovn-sbctl lsp-bind provnet1-3-port1 fakechassis +ovn-sbctl lsp-bind provnet1-4-port1 fakechassis diff --git a/tutorial/ovn/env4/setup1.sh b/tutorial/ovn/env4/setup1.sh deleted file mode 100755 index 6bb6e44b7..000000000 --- a/tutorial/ovn/env4/setup1.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set -o xtrace - -ovs-vsctl add-br br-eth1 -ovs-vsctl set open . external-ids:ovn-bridge-mappings=physnet1:br-eth1 diff --git a/tutorial/ovn/env4/setup2.sh b/tutorial/ovn/env4/setup2.sh deleted file mode 100755 index aa8cc9508..000000000 --- a/tutorial/ovn/env4/setup2.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This script simulates 2 chassis connected to a physical switch, -# which we call "physnet1". We have two logical ports, one on each hypervisor, -# that OVN will connect to physnet1. -# -# The way to accomplish this in OVN is to create a logical switch for each -# logical port. In addition to the normal logical port, each logical switch -# has a special "localnet" port, which represents the connection to physnet1. -# -# In this setup we see the view of this environment from one of the hypervisors. - -set -o xtrace - -ovn-sbctl chassis-add fakechassis geneve 127.0.0.1 - -for n in 1 2 3 4; do - ovn-nbctl ls-add provnet1-$n - - ovn-nbctl lsp-add provnet1-$n provnet1-$n-port1 - ovn-nbctl lsp-set-addresses provnet1-$n-port1 00:00:00:00:00:0$n - ovn-nbctl lsp-set-port-security provnet1-$n-port1 00:00:00:00:00:0$n - - ovn-nbctl lsp-add provnet1-$n provnet1-$n-physnet1 - ovn-nbctl lsp-set-addresses provnet1-$n-physnet1 unknown - ovn-nbctl lsp-set-type provnet1-$n-physnet1 localnet - ovn-nbctl lsp-set-options provnet1-$n-physnet1 network_name=physnet1 -done - -ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1 -ovs-vsctl add-port br-int lport2 -- set Interface lport2 external_ids:iface-id=provnet1-2-port1 - -ovn-sbctl lsp-bind provnet1-3-port1 fakechassis -ovn-sbctl lsp-bind provnet1-4-port1 fakechassis diff --git a/tutorial/ovn/env5/packet1.sh b/tutorial/ovn/env5/packet1.sh index 1ae658d40..64025c425 100755 --- a/tutorial/ovn/env5/packet1.sh +++ b/tutorial/ovn/env5/packet1.sh @@ -15,4 +15,7 @@ set -o xtrace -ovs-appctl ofproto/trace br-int in_port=5,dl_src=00:00:00:00:00:05,dl_dst=00:00:00:00:00:06 -generate +# input from local vif, lport5 (ofport 6) +# destination MAC is lport6 +# expect to go out via localnet port (ofport 7) and lport6 (ofport 8) +ovs-appctl ofproto/trace br-int in_port=6,dl_src=00:00:00:00:00:05,dl_dst=00:00:00:00:00:06 -generate diff --git a/tutorial/ovn/env5/packet2.sh b/tutorial/ovn/env5/packet2.sh index 30c51bacd..7ac5dd62c 100755 --- a/tutorial/ovn/env5/packet2.sh +++ b/tutorial/ovn/env5/packet2.sh @@ -15,4 +15,6 @@ set -o xtrace -ovs-appctl ofproto/trace br-int in_port=1,dl_src=00:00:00:00:00:07,dl_dst=ff:ff:ff:ff:ff:ff,dl_vlan=101 -generate +# We use the LOCAL port of br-eth1 to simulate the port connected to network. +# expect to arrive on lport5 (ofport 6) and lport6 (ofport 8) +ovs-appctl ofproto/trace br-eth1 in_port=LOCAL,dl_src=00:00:00:00:00:07,dl_dst=ff:ff:ff:ff:ff:ff,dl_vlan=101 -generate diff --git a/tutorial/ovn/env8/packet1.sh b/tutorial/ovn/env8/packet1.sh new file mode 100755 index 000000000..13a49d0d1 --- /dev/null +++ b/tutorial/ovn/env8/packet1.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -o xtrace + +# input from local vif, lport1 (ofport 1) +# The destination MAC is not assigned to any host. +# expect to go out via l2gateway port (ofport 3) +ovs-appctl ofproto/trace br-int in_port=1,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:03 -generate diff --git a/tutorial/ovn/env8/packet2.sh b/tutorial/ovn/env8/packet2.sh new file mode 100755 index 000000000..a4a7f8c74 --- /dev/null +++ b/tutorial/ovn/env8/packet2.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -o xtrace + +# We use the LOCAL port of br-eth1 to simulate the port connected to network. +# expect to arrive on lport1 (ofport 1) and lport2 (ofport 2) +ovs-appctl ofproto/trace br-eth1 in_port=LOCAL,dl_src=00:00:00:00:00:03,dl_dst=ff:ff:ff:ff:ff:ff -generate diff --git a/tutorial/ovn/env8/setup.sh b/tutorial/ovn/env8/setup.sh new file mode 100755 index 000000000..2bb05ff84 --- /dev/null +++ b/tutorial/ovn/env8/setup.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script simulates 2 chassis connected to a physical switch, +# which we call "physnet1". We have two logical ports, one on each hypervisor, +# that OVN will connect to physnet1. +# +# The way to accomplish this in OVN is to create a logical switch for each +# logical port. In addition to the normal logical port, each logical switch +# has a special "localnet" port, which represents the connection to physnet1. +# +# In this setup we see the view of this environment from one of the hypervisors. + +set -o xtrace + +ovn-nbctl ls-add sw0 + +ovn-nbctl lsp-add sw0 sw0-port1 +ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01 +ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01 +ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=sw0-port1 + +ovn-nbctl lsp-add sw0 sw0-port2 +ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02 +ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02 +ovs-vsctl add-port br-int lport2 -- set Interface lport2 external_ids:iface-id=sw0-port2 + +ovn-nbctl lsp-add sw0 sw0-port3 +ovn-nbctl lsp-set-addresses sw0-port3 unknown +ovn-nbctl lsp-set-type sw0-port3 l2gateway +# The chassis UUID is hard-coded in tutorial/ovs-sandbox. +ovn-nbctl lsp-set-options sw0-port3 l2gateway-chassis=56b18105-5706-46ef-80c4-ff20979ab068 network_name=physnet1 + +ovs-vsctl --may-exist add-br br-eth1 +ovs-vsctl set open . external-ids:ovn-bridge-mappings=physnet1:br-eth1 -- cgit v1.2.1