summaryrefslogtreecommitdiffstats
path: root/recipes-networking/openvswitch/files
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-networking/openvswitch/files')
-rw-r--r--recipes-networking/openvswitch/files/configure-Only-link-against-libpcap-on-FreeBSD.patch70
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-add-more-target-python-substitutions.patch50
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-add-ptest.patch67
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-add-target-perl-handling.patch48
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-add-target-python-handling.patch149
-rwxr-xr-xrecipes-networking/openvswitch/files/openvswitch-controller274
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-controller-setup29
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-example102
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-switch102
-rw-r--r--recipes-networking/openvswitch/files/openvswitch-switch-setup8
-rw-r--r--recipes-networking/openvswitch/files/run-ptest4
11 files changed, 903 insertions, 0 deletions
diff --git a/recipes-networking/openvswitch/files/configure-Only-link-against-libpcap-on-FreeBSD.patch b/recipes-networking/openvswitch/files/configure-Only-link-against-libpcap-on-FreeBSD.patch
new file mode 100644
index 00000000..0a44b85e
--- /dev/null
+++ b/recipes-networking/openvswitch/files/configure-Only-link-against-libpcap-on-FreeBSD.patch
@@ -0,0 +1,70 @@
1From d30e714ccb9d13caf39d14d5b2fc9523b678ed51 Mon Sep 17 00:00:00 2001
2From: Ben Pfaff <blp@nicira.com>
3Date: Thu, 14 Mar 2013 15:20:55 -0700
4Subject: [PATCH] configure: Only link against libpcap on FreeBSD.
5
6commit d30e714ccb9d13caf39d14d5b2fc9523b678ed51 upstream
7http://git.openvswitch.org/git/openvswitch
8
9On other platforms there is no benefit to linking against libpcap, because
10it is not used.
11
12Signed-off-by: Ben Pfaff <blp@nicira.com>
13CC: Ed Maste <emaste@freebsd.org>
14---
15 acinclude.m4 | 7 ++++++-
16 configure.ac | 3 +--
17 2 files changed, 7 insertions(+), 3 deletions(-)
18
19diff --git a/acinclude.m4 b/acinclude.m4
20index f0610c9..19a47dd 100644
21--- a/acinclude.m4
22+++ b/acinclude.m4
23@@ -1,6 +1,6 @@
24 # -*- autoconf -*-
25
26-# Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
27+# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
28 #
29 # Licensed under the Apache License, Version 2.0 (the "License");
30 # you may not use this file except in compliance with the License.
31@@ -295,6 +295,8 @@ AC_DEFUN([OVS_CHECK_IF_PACKET],
32 fi])
33
34 dnl Checks for net/if_dl.h.
35+dnl
36+dnl (We use this as a proxy for checking whether we're building on FreeBSD.)
37 AC_DEFUN([OVS_CHECK_IF_DL],
38 [AC_CHECK_HEADER([net/if_dl.h],
39 [HAVE_IF_DL=yes],
40@@ -303,6 +305,9 @@ AC_DEFUN([OVS_CHECK_IF_DL],
41 if test "$HAVE_IF_DL" = yes; then
42 AC_DEFINE([HAVE_IF_DL], [1],
43 [Define to 1 if net/if_dl.h is available.])
44+
45+ # On FreeBSD we use libpcap to access network devices.
46+ AC_SEARCH_LIBS([pcap_open_live], [pcap])
47 fi])
48
49 dnl Checks for buggy strtok_r.
50diff --git a/configure.ac b/configure.ac
51index 1cacd29..bd49179 100644
52--- a/configure.ac
53+++ b/configure.ac
54@@ -1,4 +1,4 @@
55-# Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
56+# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
57 #
58 # Licensed under the Apache License, Version 2.0 (the "License");
59 # you may not use this file except in compliance with the License.
60@@ -44,7 +44,6 @@ AC_SYS_LARGEFILE
61 AC_SEARCH_LIBS([pow], [m])
62 AC_SEARCH_LIBS([clock_gettime], [rt])
63 AC_SEARCH_LIBS([timer_create], [rt])
64-AC_SEARCH_LIBS([pcap_open_live], [pcap])
65
66 OVS_CHECK_ESX
67 OVS_CHECK_COVERAGE
68--
691.8.3.2
70
diff --git a/recipes-networking/openvswitch/files/openvswitch-add-more-target-python-substitutions.patch b/recipes-networking/openvswitch/files/openvswitch-add-more-target-python-substitutions.patch
new file mode 100644
index 00000000..2b87a116
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-add-more-target-python-substitutions.patch
@@ -0,0 +1,50 @@
1From d1ab2f62a03c2c977de6fed5fca8de63e328a870 Mon Sep 17 00:00:00 2001
2Message-Id: <d1ab2f62a03c2c977de6fed5fca8de63e328a870.1391527986.git.Jim.Somerville@windriver.com>
3From: Jim Somerville <Jim.Somerville@windriver.com>
4Date: Tue, 4 Feb 2014 15:30:41 +0000
5Subject: [PATCH 1/1] openvswitch: add more target python substitutions
6
7The TARGET_PYTHON variable is used for script
8substitutions to ensure the scripts will be able to properly execute
9if the target system has a different path for the python.
10
11Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
12---
13 ovsdb/ovsdb-dot.in | 2 +-
14 ovsdb/ovsdb-idlc.in | 2 +-
15 utilities/ovs-dpctl-top.in | 2 +-
16 3 files changed, 3 insertions(+), 3 deletions(-)
17
18diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
19index 85c126d..402a77c 100755
20--- a/ovsdb/ovsdb-dot.in
21+++ b/ovsdb/ovsdb-dot.in
22@@ -1,4 +1,4 @@
23-#! @PYTHON@
24+#! @TARGET_PYTHON@
25
26 from datetime import date
27 import ovs.db.error
28diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
29index ec1c655..f5c135f 100755
30--- a/ovsdb/ovsdb-idlc.in
31+++ b/ovsdb/ovsdb-idlc.in
32@@ -1,4 +1,4 @@
33-#! @PYTHON@
34+#! @TARGET_PYTHON@
35
36 import getopt
37 import os
38diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
39index f43fdeb..8475118 100755
40--- a/utilities/ovs-dpctl-top.in
41+++ b/utilities/ovs-dpctl-top.in
42@@ -1,4 +1,4 @@
43-#! @PYTHON@
44+#! @TARGET_PYTHON@
45 #
46 # Copyright (c) 2013 Nicira, Inc.
47 #
48--
491.8.3.4
50
diff --git a/recipes-networking/openvswitch/files/openvswitch-add-ptest.patch b/recipes-networking/openvswitch/files/openvswitch-add-ptest.patch
new file mode 100644
index 00000000..aebb1823
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-add-ptest.patch
@@ -0,0 +1,67 @@
1Add test-install rule to support ptest execution
2
3Signed-off-by: Radu Patriu <radu.patriu@enea.com>
4
5Index: ovs/Makefile.am
6===================================================================
7--- ovs.orig/Makefile.am 2014-03-10 16:19:46.000000000 +0200
8+++ ovs/Makefile.am 2014-03-10 16:23:10.481075341 +0200
9@@ -276,3 +276,4 @@
10 include python/automake.mk
11 include python/compat/automake.mk
12 include tutorial/automake.mk
13+include test.mk
14Index: ovs/test.mk
15===================================================================
16--- /dev/null 1970-01-01 00:00:00.000000000 +0000
17+++ ovs/test.mk 2014-03-10 16:42:41.000000000 +0200
18@@ -0,0 +1,49 @@
19+TEST_DEST ?= ${prefix}/lib/openvswitch
20+TEST_ROOT ?= ${prefix}/lib/openvswitch
21+TEST_DEPEND =
22+
23+if HAVE_OPENSSL
24+TEST_DEPEND += $(TESTPKI_FILES)
25+endif
26+
27+test-install: $(TEST_DEPEND)
28+ @list='$(noinst_PROGRAMS) $(EXTRA_DIST) $(dist_check_SCRIPTS) $(TEST_DEPEND) tests/atlocal tests/atconfig' ;\
29+ install -d $(TEST_DEST)/tests ;\
30+ install -d $(TEST_DEST)/python ;\
31+ install -d $(TEST_DEST)/python/ovs ;\
32+ install -d $(TEST_DEST)/python/ovs/db ;\
33+ install -d $(TEST_DEST)/python/ovs/unixctl ;\
34+ install -d $(TEST_DEST)/vswitchd ;\
35+ install vswitchd/vswitch.ovsschema $(TEST_DEST)/vswitchd ;\
36+ install -d $(TEST_DEST)/debian ;\
37+ install debian/ovs-monitor-ipsec $(TEST_DEST)/debian ;\
38+ install -d $(TEST_DEST)/build-aux ;\
39+ install build-aux/check-structs $(TEST_DEST)/build-aux ;\
40+ install -d $(TEST_DEST)/xenserver ;\
41+ install xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync $(TEST_DEST)/xenserver ;\
42+ install xenserver/opt_xensource_libexec_interface-reconfigure $(TEST_DEST)/xenserver ;\
43+ install xenserver/opt_xensource_libexec_InterfaceReconfigure.py $(TEST_DEST)/xenserver ;\
44+ install xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py $(TEST_DEST)/xenserver ;\
45+ install xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py $(TEST_DEST)/xenserver ;\
46+ install -d $(TEST_DEST)/vtep ;\
47+ install vtep/vtep.ovsschema $(TEST_DEST)/vtep ;\
48+ for p in $$list ; do \
49+ echo $$p ;\
50+ p=$${p#./} ;\
51+ pre=$${p#tests\/} ;\
52+ if test $$pre != $$p ; then \
53+ echo installing $$p to $(TEST_DEST)/tests/$$pre ;\
54+ install $$p $(TEST_DEST)/tests/$$pre ;\
55+ continue ;\
56+ fi ;\
57+ pre=$${p#python\/ovs\/} ;\
58+ if test $$pre != $$p ; then \
59+ echo installing $$p to $(TEST_DEST)/python/ovs/$$pre ;\
60+ install $$p $(TEST_DEST)/python/ovs/$$pre ;\
61+ continue ;\
62+ fi; \
63+ done ;\
64+ sed -i 's|abs_builddir=.*|abs_builddir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig
65+ sed -i 's|abs_srcdir=.*|abs_srcdir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig
66+ sed -i 's|abs_top_srcdir=.*|abs_top_srcdir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig
67+ sed -i 's|abs_top_builddir=.*|abs_top_builddir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig
diff --git a/recipes-networking/openvswitch/files/openvswitch-add-target-perl-handling.patch b/recipes-networking/openvswitch/files/openvswitch-add-target-perl-handling.patch
new file mode 100644
index 00000000..98224b42
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-add-target-perl-handling.patch
@@ -0,0 +1,48 @@
1From 569ac1066cd3046b8ac899153df9f07908d45145 Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Fri, 21 Jun 2013 11:16:00 -0400
4Subject: [PATCH] openvswitch: add target perl handling
5
6Allow the build to specify a path for the perl instead of reusing
7the PERL variable which can lead to inconsistencies if we are cross
8compiling. The TARGET_PERL variable will be used for script
9substitutions to ensure the scripts will be able to properly execute
10if the target system has a different path for the perl.
11
12Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
13---
14 Makefile.am | 1 +
15 configure.ac | 7 +++++++
16 utilities/ovs-parse-leaks.in | 2 +-
17 3 files changed, 9 insertions(+), 1 deletion(-)
18
19Index: openvswitch-2.0.0/Makefile.am
20===================================================================
21--- openvswitch-2.0.0.orig/Makefile.am
22+++ openvswitch-2.0.0/Makefile.am
23@@ -114,6 +114,7 @@
24 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
25 -e 's,[@]DBDIR[@],$(DBDIR),g' \
26 -e 's,[@]PERL[@],$(PERL),g' \
27+ -e 's,[@]TARGET_PERL[@],$(TARGET_PERL),g' \
28 -e 's,[@]PYTHON[@],$(PYTHON),g' \
29 -e 's,[@]TARGET_PYTHON[@],$(TARGET_PYTHON),g' \
30 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
31Index: openvswitch-2.0.0/configure.ac
32===================================================================
33--- openvswitch-2.0.0.orig/configure.ac
34+++ openvswitch-2.0.0/configure.ac
35@@ -115,6 +115,13 @@
36 AC_SUBST(KARCH)
37 OVS_CHECK_LINUX
38
39+if test "$TARGET_PERL"; then
40+ TARGET_PERL=$TARGET_PERL
41+else
42+ TARGET_PERL=$PERL
43+fi
44+AC_SUBST(TARGET_PERL)
45+
46 if test "$TARGET_PYTHON"; then
47 TARGET_PYTHON=$TARGET_PYTHON
48 else
diff --git a/recipes-networking/openvswitch/files/openvswitch-add-target-python-handling.patch b/recipes-networking/openvswitch/files/openvswitch-add-target-python-handling.patch
new file mode 100644
index 00000000..59607dad
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-add-target-python-handling.patch
@@ -0,0 +1,149 @@
1From e8a5d34885c5fdba7d951fb1bb85131cbafca432 Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Wed, 19 Jun 2013 17:25:56 -0400
4Subject: [PATCH] openvswitch: add target python handling
5
6Allow the build to specify a path for the python instead of reusing
7the PYTHON variable which can lead to inconsistencies if we are cross
8compiling. The TARGET_PYTHON variable will be used for script
9substitutions to ensure the scripts will be able to properly execute
10if the target system has a different path for the python.
11
12Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
13---
14 Makefile.am | 1 +
15 configure.ac | 7 +++++++
16 ovsdb/ovsdbmonitor/ovsdbmonitor.in | 2 +-
17 utilities/bugtool/ovs-bugtool.in | 2 +-
18 utilities/ovs-check-dead-ifs.in | 2 +-
19 utilities/ovs-l3ping.in | 2 +-
20 utilities/ovs-parse-backtrace.in | 2 +-
21 utilities/ovs-pcap.in | 2 +-
22 utilities/ovs-tcpundump.in | 2 +-
23 utilities/ovs-test.in | 2 +-
24 utilities/ovs-vlan-test.in | 2 +-
25 11 files changed, 17 insertions(+), 9 deletions(-)
26
27diff --git a/Makefile.am b/Makefile.am
28index b71ca1f..c4f8341 100644
29--- a/Makefile.am
30+++ b/Makefile.am
31@@ -112,6 +112,7 @@ SUFFIXES += .in
32 -e 's,[@]DBDIR[@],$(DBDIR),g' \
33 -e 's,[@]PERL[@],$(PERL),g' \
34 -e 's,[@]PYTHON[@],$(PYTHON),g' \
35+ -e 's,[@]TARGET_PYTHON[@],$(TARGET_PYTHON),g' \
36 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
37 -e 's,[@]VERSION[@],$(VERSION),g' \
38 -e 's,[@]localstatedir[@],$(localstatedir),g' \
39diff --git a/configure.ac b/configure.ac
40index 060b53f..74cb691 100644
41--- a/configure.ac
42+++ b/configure.ac
43@@ -101,6 +101,13 @@ AC_ARG_VAR(KARCH, [Kernel Architecture String])
44 AC_SUBST(KARCH)
45 OVS_CHECK_LINUX
46
47+if test "$TARGET_PYTHON"; then
48+ TARGET_PYTHON=$TARGET_PYTHON
49+else
50+ TARGET_PYTHON=$PYTHON
51+fi
52+AC_SUBST(TARGET_PYTHON)
53+
54 AC_CONFIG_FILES([Makefile
55 datapath/Makefile
56 datapath/linux/Kbuild
57diff --git a/ovsdb/ovsdbmonitor/ovsdbmonitor.in b/ovsdb/ovsdbmonitor/ovsdbmonitor.in
58index e26130a..aaf1aff 100755
59--- a/ovsdb/ovsdbmonitor/ovsdbmonitor.in
60+++ b/ovsdb/ovsdbmonitor/ovsdbmonitor.in
61@@ -1,4 +1,4 @@
62-#! @PYTHON@
63+#! @TARGET_PYTHON@
64 # Copyright (c) 2010 Citrix Systems, Inc.
65 #
66 # Licensed under the Apache License, Version 2.0 (the "License");
67diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
68index 2074e23..525939e 100755
69--- a/utilities/bugtool/ovs-bugtool.in
70+++ b/utilities/bugtool/ovs-bugtool.in
71@@ -1,4 +1,4 @@
72-#! @PYTHON@
73+#! @TARGET_PYTHON@
74
75 # This library is free software; you can redistribute it and/or
76 # modify it under the terms of version 2.1 of the GNU Lesser General Public
77diff --git a/utilities/ovs-check-dead-ifs.in b/utilities/ovs-check-dead-ifs.in
78index 9b806ed..b6f6fcb 100755
79--- a/utilities/ovs-check-dead-ifs.in
80+++ b/utilities/ovs-check-dead-ifs.in
81@@ -1,4 +1,4 @@
82-#! @PYTHON@
83+#! @TARGET_PYTHON@
84
85 import os
86 import re
87diff --git a/utilities/ovs-l3ping.in b/utilities/ovs-l3ping.in
88index 1b07972..4fedb6f 100644
89--- a/utilities/ovs-l3ping.in
90+++ b/utilities/ovs-l3ping.in
91@@ -1,4 +1,4 @@
92-#! @PYTHON@
93+#! @TARGET_PYTHON@
94 #
95 # Licensed under the Apache License, Version 2.0 (the "License");
96 # you may not use this file except in compliance with the License.
97diff --git a/utilities/ovs-parse-backtrace.in b/utilities/ovs-parse-backtrace.in
98index 4f793be..4a07f47 100755
99--- a/utilities/ovs-parse-backtrace.in
100+++ b/utilities/ovs-parse-backtrace.in
101@@ -1,4 +1,4 @@
102-#! @PYTHON@
103+#! @TARGET_PYTHON@
104 #
105 # Copyright (c) 2012 Nicira, Inc.
106 #
107diff --git a/utilities/ovs-pcap.in b/utilities/ovs-pcap.in
108index 5306480..3221c7c 100755
109--- a/utilities/ovs-pcap.in
110+++ b/utilities/ovs-pcap.in
111@@ -1,4 +1,4 @@
112-#! @PYTHON@
113+#! @TARGET_PYTHON@
114 #
115 # Copyright (c) 2010 Nicira, Inc.
116 #
117diff --git a/utilities/ovs-tcpundump.in b/utilities/ovs-tcpundump.in
118index 0268c50..dad0bb5 100755
119--- a/utilities/ovs-tcpundump.in
120+++ b/utilities/ovs-tcpundump.in
121@@ -1,4 +1,4 @@
122-#! @PYTHON@
123+#! @TARGET_PYTHON@
124 #
125 # Copyright (c) 2010 Nicira, Inc.
126 #
127diff --git a/utilities/ovs-test.in b/utilities/ovs-test.in
128index fb1f9ad..bddd327 100644
129--- a/utilities/ovs-test.in
130+++ b/utilities/ovs-test.in
131@@ -1,4 +1,4 @@
132-#! @PYTHON@
133+#! @TARGET_PYTHON@
134 #
135 # Licensed under the Apache License, Version 2.0 (the "License");
136 # you may not use this file except in compliance with the License.
137diff --git a/utilities/ovs-vlan-test.in b/utilities/ovs-vlan-test.in
138index e229498..da64040 100755
139--- a/utilities/ovs-vlan-test.in
140+++ b/utilities/ovs-vlan-test.in
141@@ -1,4 +1,4 @@
142-#! @PYTHON@
143+#! @TARGET_PYTHON@
144 #
145 # Copyright (c) 2010 Nicira, Inc.
146 #
147--
1481.8.1.2
149
diff --git a/recipes-networking/openvswitch/files/openvswitch-controller b/recipes-networking/openvswitch/files/openvswitch-controller
new file mode 100755
index 00000000..026974a7
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-controller
@@ -0,0 +1,274 @@
1#!/bin/sh
2#
3# Copyright (c) 2011 Nicira Networks Inc.
4# Copyright (c) 2007, 2009 Javier Fernandez-Sanguino <jfs@debian.org>
5#
6# This is free software; you may redistribute it and/or modify
7# it under the terms of the GNU General Public License as
8# published by the Free Software Foundation; either version 2,
9# or (at your option) any later version.
10#
11# This is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License with
17# the Debian operating system, in /usr/share/common-licenses/GPL; if
18# not, write to the Free Software Foundation, Inc., 59 Temple Place,
19# Suite 330, Boston, MA 02111-1307 USA
20#
21### BEGIN INIT INFO
22# Provides: openvswitch-controller
23# Required-Start: $network $local_fs $remote_fs
24# Required-Stop: $remote_fs
25# Should-Start: $named
26# Should-Stop:
27# Default-Start: 2 3 4 5
28# Default-Stop: 0 1 6
29# Short-Description: Open vSwitch controller
30### END INIT INFO
31
32PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
33
34DAEMON=/usr/bin/ovs-controller # Introduce the server's location here
35NAME=ovs-controller # Introduce the short server's name here
36DESC=ovs-controller # Introduce a short description here
37LOGDIR=/var/log/openvswitch # Log directory to use
38
39PIDFILE=/var/run/openvswitch/$NAME.pid
40
41test -x $DAEMON || exit 0
42
43. /lib/lsb/init-functions
44
45# Default options, these can be overriden by the information
46# at /etc/default/openvswitch-controller
47DAEMON_OPTS="" # Additional options given to the server
48
49DODTIME=10 # Time to wait for the server to die, in seconds
50 # If this value is set too low you might not
51 # let some servers to die gracefully and
52 # 'restart' will not work
53
54LOGFILE=$LOGDIR/$NAME.log # Server logfile
55#DAEMONUSER= # User to run the daemons as. If this value
56 # is set start-stop-daemon will chuid the server
57
58# Include defaults if available
59default=/etc/default/openvswitch-controller
60if [ -f $default ] ; then
61 . $default
62fi
63
64# Check that the user exists (if we set a user)
65# Does the user exist?
66if [ -n "$DAEMONUSER" ] ; then
67 if getent passwd | grep -q "^$DAEMONUSER:"; then
68 # Obtain the uid and gid
69 DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'`
70 DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'`
71 else
72 log_failure_msg "The user $DAEMONUSER, required to run $NAME does not exist."
73 exit 1
74 fi
75fi
76
77
78set -e
79
80running_pid() {
81# Check if a given process pid's cmdline matches a given name
82 pid=$1
83 name=$2
84 [ -z "$pid" ] && return 1
85 [ ! -d /proc/$pid ] && return 1
86 cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
87 # Is this the expected server
88 [ "$cmd" != "$name" ] && return 1
89 return 0
90}
91
92running() {
93# Check if the process is running looking at /proc
94# (works for all users)
95
96 # No pidfile, probably no daemon present
97 [ ! -f "$PIDFILE" ] && return 1
98 pid=`cat $PIDFILE`
99 running_pid $pid $DAEMON || return 1
100 return 0
101}
102
103start_server() {
104 if [ -z "$LISTEN" ]; then
105 echo "$default: No connection methods configured, controller disabled" >&2
106 exit 0
107 fi
108
109 if [ ! -d /var/run/openvswitch ]; then
110 install -d -m 755 -o root -g root /var/run/openvswitch
111 fi
112
113 SSL_OPTS=
114 case $LISTEN in
115 *ssl*)
116 : ${PRIVKEY:=/etc/openvswitch-controller/privkey.pem}
117 : ${CERT:=/etc/openvswitch-controller/cert.pem}
118 : ${CACERT:=/etc/openvswitch-controller/cacert.pem}
119 if test ! -e "$PRIVKEY" || test ! -e "$CERT" ||
120 test ! -e "$CACERT"; then
121 if test ! -e "$PRIVKEY"; then
122 echo "$PRIVKEY: private key missing" >&2
123 fi
124 if test ! -e "$CERT"; then
125 echo "$CERT: certificate for private key missing" >&2
126 fi
127 if test ! -e "$CACERT"; then
128 echo "$CACERT: CA certificate missing" >&2
129 fi
130 exit 1
131 fi
132 SSL_OPTS="--private-key=$PRIVKEY --certificate=$CERT --ca-cert=$CACERT"
133 ;;
134 esac
135
136# Start the process using the wrapper
137 if [ -z "$DAEMONUSER" ] ; then
138 start-stop-daemon --start --pidfile $PIDFILE \
139 --exec $DAEMON -- --detach --pidfile=$PIDFILE \
140 $LISTEN $DAEMON_OPTS $SSL_OPTS
141 errcode=$?
142 else
143# if we are using a daemonuser then change the user id
144 start-stop-daemon --start --quiet --pidfile $PIDFILE \
145 --chuid $DAEMONUSER --exec $DAEMON -- \
146 --detach --pidfile=$PIDFILE $LISTEN $DAEMON_OPTS \
147 $SSL_OPTS
148 errcode=$?
149 fi
150 return $errcode
151}
152
153stop_server() {
154# Stop the process using the wrapper
155 if [ -z "$DAEMONUSER" ] ; then
156 start-stop-daemon --stop --quiet --pidfile $PIDFILE \
157 --exec $DAEMON
158 errcode=$?
159 else
160# if we are using a daemonuser then look for process that match
161 start-stop-daemon --stop --quiet --pidfile $PIDFILE \
162 --user $DAEMONUSER --exec $DAEMON
163 errcode=$?
164 fi
165
166 return $errcode
167}
168
169reload_server() {
170 [ ! -f "$PIDFILE" ] && return 1
171 pid=`cat $PIDFILE` # This is the daemon's pid
172 # Send a SIGHUP
173 kill -1 $pid
174 return $?
175}
176
177force_stop() {
178# Force the process to die killing it manually
179 [ ! -e "$PIDFILE" ] && return
180 if running ; then
181 kill -15 $pid
182 # Is it really dead?
183 sleep "$DODTIME"
184 if running ; then
185 kill -9 $pid
186 sleep "$DODTIME"
187 if running ; then
188 echo "Cannot kill $NAME (pid=$pid)!"
189 exit 1
190 fi
191 fi
192 fi
193 rm -f $PIDFILE
194}
195
196
197case "$1" in
198 start)
199 log_begin_msg "Starting $DESC " "$NAME"
200 # Check if it's running first
201 if running ; then
202 log_warning_msg "apparently already running"
203 log_end_msg 0
204 exit 0
205 fi
206 if start_server && running ; then
207 # It's ok, the server started and is running
208 log_end_msg 0
209 else
210 # Either we could not start it or it is not running
211 # after we did
212 # NOTE: Some servers might die some time after they start,
213 # this code does not try to detect this and might give
214 # a false positive (use 'status' for that)
215 log_end_msg 1
216 fi
217 ;;
218 stop)
219 log_begin_msg "Stopping $DESC" "$NAME"
220 if running ; then
221 # Only stop the server if we see it running
222 stop_server
223 log_end_msg $?
224 else
225 # If it's not running don't do anything
226 log_warning_msg "apparently not running"
227 log_end_msg 0
228 exit 0
229 fi
230 ;;
231 force-stop)
232 # First try to stop gracefully the program
233 $0 stop
234 if running; then
235 # If it's still running try to kill it more forcefully
236 log_begin_msg "Stopping (force) $DESC" "$NAME"
237 force_stop
238 log_end_msg $?
239 fi
240 ;;
241 restart|force-reload)
242 log_begin_msg "Restarting $DESC" "$NAME"
243 stop_server
244 # Wait some sensible amount, some server need this
245 [ -n "$DODTIME" ] && sleep $DODTIME
246 start_server
247 running
248 log_end_msg $?
249 ;;
250 status)
251
252 log_begin_msg "Checking status of $DESC" "$NAME"
253 if running ; then
254 log_begin_msg "running"
255 log_end_msg 0
256 else
257 log_warning_msg "apparently not running"
258 log_end_msg 1
259 exit 1
260 fi
261 ;;
262 # Use this if the daemon cannot reload
263 reload)
264 log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
265 log_warning_msg "cannot re-read the config file (use restart)."
266 ;;
267 *)
268 N=/etc/init.d/openvswitch-controller
269 echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
270 exit 1
271 ;;
272esac
273
274exit 0
diff --git a/recipes-networking/openvswitch/files/openvswitch-controller-setup b/recipes-networking/openvswitch/files/openvswitch-controller-setup
new file mode 100644
index 00000000..1d9f9261
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-controller-setup
@@ -0,0 +1,29 @@
1# This is a POSIX shell fragment -*- sh -*-
2
3# LISTEN: What OpenFlow connection methods should the controller listen on?
4#
5# This is a space-delimited list of connection methods:
6#
7# * "pssl:[PORT]": Listen for SSL connections on the specified PORT
8# (default: 6633). The private key, certificate, and CA certificate
9# must be specified below.
10#
11# * "pctp:[PORT]": Listen for TCP connections on the specified PORT
12# (default: 6633). Not recommended for security reasons.
13#
14LISTEN="pssl:"
15
16# PRIVKEY: Name of file containing controller's private key.
17# Required if SSL enabled.
18PRIVKEY=/etc/openvswitch-controller/privkey.pem
19
20# CERT: Name of file containing certificate for private key.
21# Required if SSL enabled.
22CERT=/etc/openvswitch-controller/cert.pem
23
24# CACERT: Name of file containing switch CA certificate.
25# Required if SSL enabled.
26CACERT=/etc/openvswitch-controller/cacert.pem
27
28# Additional options to pass to controller, e.g. "--hub"
29DAEMON_OPTS=""
diff --git a/recipes-networking/openvswitch/files/openvswitch-example b/recipes-networking/openvswitch/files/openvswitch-example
new file mode 100644
index 00000000..6f08c3fa
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-example
@@ -0,0 +1,102 @@
1#! /bin/sh
2#
3# Copyright (C) 2011 Nicira Networks, Inc.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at:
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17### BEGIN INIT INFO
18# Provides: openvswitch-switch
19# Required-Start: $network $named $remote_fs $syslog
20# Required-Stop: $remote_fs
21# Default-Start: 2 3 4 5
22# Default-Stop: 0 1 6
23# Short-Description: Open vSwitch switch
24### END INIT INFO
25
26(test -x /usr/sbin/ovs-vswitchd && test -x /usr/sbin/ovsdb-server) || exit 0
27
28. /usr/share/openvswitch/scripts/ovs-lib
29test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
30
31if test X"$BRCOMPAT" = Xyes && test ! -x /usr/sbin/ovs-brcompatd; then
32 BRCOMPAT=no
33 log_warning_msg "ovs-brcompatd missing, disabling bridge compatibility"
34fi
35
36ovs_ctl () {
37 set /usr/share/openvswitch/scripts/ovs-ctl "$@"
38 if test X"$BRCOMPAT" = Xyes; then
39 set "$@" --brcompat
40 fi
41 "$@"
42}
43
44load_kmod () {
45 ovs_ctl load-kmod || exit $?
46}
47
48start () {
49 if ovs_ctl load-kmod; then
50 :
51 else
52 echo "Module has probably not been built for this kernel."
53 if ! test -d /usr/share/doc/openvswitch-datapath-source; then
54 echo "Install the openvswitch-datapath-source package, then read"
55 else
56 echo "For instructions, read"
57 fi
58 echo "/usr/share/doc/openvswitch-datapath-source/README.Debian"
59 fi
60 set ovs_ctl ${1-start} --system-id=random
61 if test X"$FORCE_COREFILES" != X; then
62 set "$@" --force-corefiles="$FORCE_COREFILES"
63 fi
64 "$@" || exit $?
65
66 ovs_ctl --protocol=gre enable-protocol
67}
68
69stop () {
70 ovs_ctl stop
71}
72
73case $1 in
74 start)
75 start
76 ;;
77 stop | force-stop)
78 stop
79 ;;
80 reload | force-reload)
81 # The OVS daemons keep up-to-date.
82 ;;
83 restart)
84 stop
85 start
86 ;;
87 status)
88 ovs_ctl status
89 ;;
90 force-reload-kmod)
91 start force-reload-kmod
92 ;;
93 load-kmod)
94 load_kmod
95 ;;
96 *)
97 echo "Usage: $0 {start|stop|restart|force-reload|status|force-stop|force-reload-kmod|load-kmod}" >&2
98 exit 1
99 ;;
100esac
101
102exit 0
diff --git a/recipes-networking/openvswitch/files/openvswitch-switch b/recipes-networking/openvswitch/files/openvswitch-switch
new file mode 100644
index 00000000..6f08c3fa
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-switch
@@ -0,0 +1,102 @@
1#! /bin/sh
2#
3# Copyright (C) 2011 Nicira Networks, Inc.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at:
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17### BEGIN INIT INFO
18# Provides: openvswitch-switch
19# Required-Start: $network $named $remote_fs $syslog
20# Required-Stop: $remote_fs
21# Default-Start: 2 3 4 5
22# Default-Stop: 0 1 6
23# Short-Description: Open vSwitch switch
24### END INIT INFO
25
26(test -x /usr/sbin/ovs-vswitchd && test -x /usr/sbin/ovsdb-server) || exit 0
27
28. /usr/share/openvswitch/scripts/ovs-lib
29test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
30
31if test X"$BRCOMPAT" = Xyes && test ! -x /usr/sbin/ovs-brcompatd; then
32 BRCOMPAT=no
33 log_warning_msg "ovs-brcompatd missing, disabling bridge compatibility"
34fi
35
36ovs_ctl () {
37 set /usr/share/openvswitch/scripts/ovs-ctl "$@"
38 if test X"$BRCOMPAT" = Xyes; then
39 set "$@" --brcompat
40 fi
41 "$@"
42}
43
44load_kmod () {
45 ovs_ctl load-kmod || exit $?
46}
47
48start () {
49 if ovs_ctl load-kmod; then
50 :
51 else
52 echo "Module has probably not been built for this kernel."
53 if ! test -d /usr/share/doc/openvswitch-datapath-source; then
54 echo "Install the openvswitch-datapath-source package, then read"
55 else
56 echo "For instructions, read"
57 fi
58 echo "/usr/share/doc/openvswitch-datapath-source/README.Debian"
59 fi
60 set ovs_ctl ${1-start} --system-id=random
61 if test X"$FORCE_COREFILES" != X; then
62 set "$@" --force-corefiles="$FORCE_COREFILES"
63 fi
64 "$@" || exit $?
65
66 ovs_ctl --protocol=gre enable-protocol
67}
68
69stop () {
70 ovs_ctl stop
71}
72
73case $1 in
74 start)
75 start
76 ;;
77 stop | force-stop)
78 stop
79 ;;
80 reload | force-reload)
81 # The OVS daemons keep up-to-date.
82 ;;
83 restart)
84 stop
85 start
86 ;;
87 status)
88 ovs_ctl status
89 ;;
90 force-reload-kmod)
91 start force-reload-kmod
92 ;;
93 load-kmod)
94 load_kmod
95 ;;
96 *)
97 echo "Usage: $0 {start|stop|restart|force-reload|status|force-stop|force-reload-kmod|load-kmod}" >&2
98 exit 1
99 ;;
100esac
101
102exit 0
diff --git a/recipes-networking/openvswitch/files/openvswitch-switch-setup b/recipes-networking/openvswitch/files/openvswitch-switch-setup
new file mode 100644
index 00000000..73387fbc
--- /dev/null
+++ b/recipes-networking/openvswitch/files/openvswitch-switch-setup
@@ -0,0 +1,8 @@
1# This is a POSIX shell fragment -*- sh -*-
2
3# FORCE_COREFILES: If 'yes' then core files will be enabled.
4# FORCE_COREFILES=yes
5
6# BRCOMPAT: If 'yes' and the openvswitch-brcompat package is installed, then
7# Linux bridge compatibility will be enabled.
8# BRCOMPAT=yes
diff --git a/recipes-networking/openvswitch/files/run-ptest b/recipes-networking/openvswitch/files/run-ptest
new file mode 100644
index 00000000..dd067076
--- /dev/null
+++ b/recipes-networking/openvswitch/files/run-ptest
@@ -0,0 +1,4 @@
1#!/bin/sh
2
3./tests/testsuite --am-fmt -C tests AUTOTEST_PATH=utilities:vswitchd:ovsdb:tests
4