summaryrefslogtreecommitdiffstats
path: root/recipes-networking/openvswitch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-networking/openvswitch')
-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
-rw-r--r--recipes-networking/openvswitch/openvswitch_1.10.0.bb118
-rw-r--r--recipes-networking/openvswitch/openvswitch_2.0.0.bb130
13 files changed, 1151 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
diff --git a/recipes-networking/openvswitch/openvswitch_1.10.0.bb b/recipes-networking/openvswitch/openvswitch_1.10.0.bb
new file mode 100644
index 00000000..42d4bc44
--- /dev/null
+++ b/recipes-networking/openvswitch/openvswitch_1.10.0.bb
@@ -0,0 +1,118 @@
1SUMMARY = "OpenvSwitch"
2DESCRIPTION = "Open vSwitch is a production quality, multilayer virtual switch licensed under the open source Apache 2.0 license. It is designed to enable massive network automation through programmatic extension, while still supporting standard management interfaces and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag)"
3HOMEPAGE = "http://openvswitch.org/"
4SECTION = "networking"
5LICENSE = "Apache-2"
6
7DEPENDS += "bridge-utils openssl python perl"
8
9RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \
10 python perl perl-module-strict ${PN}-switch ${PN}-controller"
11RDEPENDS_${PN}-controller = "${PN} lsb ${PN}-pki"
12RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen"
13RDEPENDS_${PN}-pki = "${PN}"
14RDEPENDS_${PN}-brcompat = "${PN} ${PN}-switch"
15RRECOMMENDS_${PN} += "kernel-module-openvswitch"
16
17# Some installers will fail because of an install order based on
18# rdeps. E.g. ovs-pki calls sed in the postinstall. sed may be
19# queued for install later.
20RDEPENDS_${PN} += "sed gawk grep"
21PR = "r4"
22
23SRC_URI = "http://openvswitch.org/releases/openvswitch-${PV}.tar.gz \
24 file://openvswitch-switch \
25 file://openvswitch-switch-setup \
26 file://openvswitch-controller \
27 file://openvswitch-controller-setup \
28 file://openvswitch-add-target-python-handling.patch \
29 file://openvswitch-add-target-perl-handling.patch \
30 file://configure-Only-link-against-libpcap-on-FreeBSD.patch \
31 "
32
33SRC_URI[md5sum] = "fe8b49efe9f86b57abab00166b971106"
34SRC_URI[sha256sum] = "803966c89d6a5de6d710a2cb4ed73ac8d8111a2c44b12b846dcef8e91ffab167"
35LIC_FILES_CHKSUM = "file://COPYING;md5=49eeb5acb1f5e510f12c44f176c42253"
36
37# Don't compile kernel modules by default since it heavily depends on
38# kernel version. Use the in-kernel module for now.
39# distro layers can enable with EXTRA_OECONF_pn_openvswitch += ""
40# EXTRA_OECONF = "--with-linux=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}"
41
42EXTRA_OECONF += "TARGET_PYTHON=${bindir}/python \
43 TARGET_PERL=${bindir}/perl \
44 "
45
46ALLOW_EMPTY_${PN}-pki = "1"
47PACKAGES =+ "${PN}-controller ${PN}-switch ${PN}-brcompat ${PN}-pki"
48
49FILES_${PN}-controller = "${sysconfdir}/init.d/openvswitch-controller \
50 ${sysconfdir}/default/openvswitch-controller \
51 ${sysconfdir}/openvswitch-controller \
52 ${bindir}/ovs-controller"
53
54FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd"
55
56FILES_${PN}-switch = "${sysconfdir}/init.d/openvswitch-switch \
57 ${sysconfdir}/default/openvswitch-switch \
58 "
59# silence a warning
60FILES_${PN} += "${datadir}/ovsdbmonitor"
61FILES_${PN} += "/run"
62
63inherit autotools update-rc.d pkgconfig
64
65INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-controller"
66INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch"
67INITSCRIPT_PARAMS_${PN}-switch = "defaults 71"
68
69INITSCRIPT_NAME_${PN}-controller = "openvswitch-controller"
70INITSCRIPT_PARAMS_${PN}-controller = "defaults 72"
71
72do_install_append() {
73 install -d ${D}/${sysconfdir}/default/
74 install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch
75 install -d ${D}/${sysconfdir}/openvswitch-controller
76 install -m 660 ${WORKDIR}/openvswitch-controller-setup ${D}/${sysconfdir}/default/openvswitch-controller
77
78 install -d ${D}/${sysconfdir}/init.d/
79 install -m 755 ${WORKDIR}/openvswitch-controller ${D}/${sysconfdir}/init.d/openvswitch-controller
80 install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch
81 true || rm -fr ${D}/${datadir}/${PN}/pki
82}
83
84pkg_postinst_${PN}-pki () {
85 # can't do this offline
86 if [ "x$D" != "x" ]; then
87 exit 1
88 fi
89 if test ! -d $D/${datadir}/${PN}/pki; then
90 ovs-pki init --dir=$D/${datadir}/${PN}/pki
91 fi
92}
93
94pkg_postinst_${PN}-controller () {
95 # can't do this offline
96 if [ "x$D" != "x" ]; then
97 exit 1
98 fi
99
100 if test ! -d $D/${datadir}/${PN}/pki; then
101 ovs-pki init --dir=$D/${datadir}/${PN}/pki
102 fi
103
104 cd $D/${sysconfdir}/openvswitch-controller
105 if ! test -e cacert.pem; then
106 ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem
107 fi
108 if ! test -e privkey.pem || ! test -e cert.pem; then
109 oldumask=$(umask)
110 umask 077
111 ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null
112 mv tmp-privkey.pem privkey.pem
113 mv tmp-cert.pem cert.pem
114 mv tmp-req.pem req.pem
115 chmod go+r cert.pem req.pem
116 umask $oldumask
117 fi
118}
diff --git a/recipes-networking/openvswitch/openvswitch_2.0.0.bb b/recipes-networking/openvswitch/openvswitch_2.0.0.bb
new file mode 100644
index 00000000..01003082
--- /dev/null
+++ b/recipes-networking/openvswitch/openvswitch_2.0.0.bb
@@ -0,0 +1,130 @@
1SUMMARY = "OpenvSwitch"
2DESCRIPTION = "Open vSwitch is a production quality, multilayer virtual switch licensed under the open source Apache 2.0 license. It is designed to enable massive network automation through programmatic extension, while still supporting standard management interfaces and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag)"
3HOMEPAGE = "http://openvswitch.org/"
4SECTION = "networking"
5LICENSE = "Apache-2"
6
7DEPENDS += "bridge-utils openssl python perl"
8
9RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \
10 python perl perl-module-strict ${PN}-switch ${PN}-controller"
11RDEPENDS_${PN}-controller = "${PN} lsb ${PN}-pki"
12RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen"
13RDEPENDS_${PN}-pki = "${PN}"
14RDEPENDS_${PN}-brcompat = "${PN} ${PN}-switch"
15RRECOMMENDS_${PN} += "kernel-module-openvswitch"
16
17RDEPENDS_${PN}-ptest += "python-logging python-syslog python-argparse python-io \
18 python-fcntl python-shell python-lang python-xml python-math \
19 python-datetime python-netclient python sed"
20
21# Some installers will fail because of an install order based on
22# rdeps. E.g. ovs-pki calls sed in the postinstall. sed may be
23# queued for install later.
24RDEPENDS_${PN} += "sed gawk grep"
25
26SRC_URI = "http://openvswitch.org/releases/openvswitch-${PV}.tar.gz \
27 file://openvswitch-switch \
28 file://openvswitch-switch-setup \
29 file://openvswitch-controller \
30 file://openvswitch-controller-setup \
31 file://openvswitch-add-target-python-handling.patch \
32 file://openvswitch-add-target-perl-handling.patch \
33 file://openvswitch-add-more-target-python-substitutions.patch \
34 file://openvswitch-add-ptest.patch \
35 file://run-ptest \
36 "
37
38SRC_URI[md5sum] = "7d7a58350e634e515e0fe43c64d64f44"
39SRC_URI[sha256sum] = "5060e2be69cce01c15f67b481482cb1a0eaa6ef5cbdbed592bac3c3ab2a390f8"
40
41LIC_FILES_CHKSUM = "file://COPYING;md5=49eeb5acb1f5e510f12c44f176c42253"
42
43# Don't compile kernel modules by default since it heavily depends on
44# kernel version. Use the in-kernel module for now.
45# distro layers can enable with EXTRA_OECONF_pn_openvswitch += ""
46# EXTRA_OECONF = "--with-linux=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}"
47
48EXTRA_OECONF += "TARGET_PYTHON=${bindir}/python \
49 TARGET_PERL=${bindir}/perl \
50 "
51
52ALLOW_EMPTY_${PN}-pki = "1"
53PACKAGES =+ "${PN}-controller ${PN}-switch ${PN}-brcompat ${PN}-pki"
54
55FILES_${PN}-controller = "${sysconfdir}/init.d/openvswitch-controller \
56 ${sysconfdir}/default/openvswitch-controller \
57 ${sysconfdir}/openvswitch-controller \
58 ${bindir}/ovs-controller"
59
60FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd"
61
62FILES_${PN}-switch = "${sysconfdir}/init.d/openvswitch-switch \
63 ${sysconfdir}/default/openvswitch-switch \
64 "
65# silence a warning
66FILES_${PN} += "${datadir}/ovsdbmonitor"
67FILES_${PN} += "/run"
68
69inherit autotools update-rc.d ptest
70
71EXTRA_OEMAKE += "TEST_DEST=${D}${PTEST_PATH} TEST_ROOT=${PTEST_PATH}"
72
73do_install_ptest() {
74 oe_runmake test-install
75}
76
77INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-controller"
78INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch"
79INITSCRIPT_PARAMS_${PN}-switch = "defaults 71"
80
81INITSCRIPT_NAME_${PN}-controller = "openvswitch-controller"
82INITSCRIPT_PARAMS_${PN}-controller = "defaults 72"
83
84do_install_append() {
85 install -d ${D}/${sysconfdir}/default/
86 install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch
87 install -d ${D}/${sysconfdir}/openvswitch-controller
88 install -m 660 ${WORKDIR}/openvswitch-controller-setup ${D}/${sysconfdir}/default/openvswitch-controller
89
90 install -d ${D}/${sysconfdir}/init.d/
91 install -m 755 ${WORKDIR}/openvswitch-controller ${D}/${sysconfdir}/init.d/openvswitch-controller
92 install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch
93 true || rm -fr ${D}/${datadir}/${PN}/pki
94}
95
96pkg_postinst_${PN}-pki () {
97 # can't do this offline
98 if [ "x$D" != "x" ]; then
99 exit 1
100 fi
101 if test ! -d $D/${datadir}/${PN}/pki; then
102 ovs-pki init --dir=$D/${datadir}/${PN}/pki
103 fi
104}
105
106pkg_postinst_${PN}-controller () {
107 # can't do this offline
108 if [ "x$D" != "x" ]; then
109 exit 1
110 fi
111
112 if test ! -d $D/${datadir}/${PN}/pki; then
113 ovs-pki init --dir=$D/${datadir}/${PN}/pki
114 fi
115
116 cd $D/${sysconfdir}/openvswitch-controller
117 if ! test -e cacert.pem; then
118 ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem
119 fi
120 if ! test -e privkey.pem || ! test -e cert.pem; then
121 oldumask=$(umask)
122 umask 077
123 ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null
124 mv tmp-privkey.pem privkey.pem
125 mv tmp-cert.pem cert.pem
126 mv tmp-req.pem req.pem
127 chmod go+r cert.pem req.pem
128 umask $oldumask
129 fi
130}