diff options
Diffstat (limited to 'external/meta-virtualization/recipes-networking')
21 files changed, 1886 insertions, 0 deletions
diff --git a/external/meta-virtualization/recipes-networking/cni/cni_git.bb b/external/meta-virtualization/recipes-networking/cni/cni_git.bb new file mode 100644 index 00000000..f7a7597b --- /dev/null +++ b/external/meta-virtualization/recipes-networking/cni/cni_git.bb @@ -0,0 +1,98 @@ +HOMEPAGE = "https://github.com/containernetworking/cni" +SUMMARY = "Container Network Interface - networking for Linux containers" +DESCRIPTION = "CNI (Container Network Interface), a Cloud Native Computing \ +Foundation project, consists of a specification and libraries for writing \ +plugins to configure network interfaces in Linux containers, along with a \ +number of supported plugins. CNI concerns itself only with network connectivity \ +of containers and removing allocated resources when the container is deleted. \ +Because of this focus, CNI has a wide range of support and the specification \ +is simple to implement. \ +" + +SRCREV_cni = "cc562d1b44b3d00b8c341250d49a8a0823a1c085" +SRCREV_plugins = "9abd20edd6c83385ff6c2a6e6ff265158059e723" +SRC_URI = "\ + git://github.com/containernetworking/cni.git;nobranch=1;name=cni \ + git://github.com/containernetworking/plugins.git;nobranch=1;destsuffix=plugins;name=plugins \ + " + +RPROVIDES_${PN} += "kubernetes-cni" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" + +GO_IMPORT = "import" + +PV = "0.6.0+git${SRCREV_cni}" + +inherit go +inherit goarch + +do_compile() { + export GOARCH="${TARGET_GOARCH}" + export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" + export GOPATH="${S}/src/import:${S}/src/import/vendor" + + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export CGO_ENABLED="1" + export CFLAGS="" + export LDFLAGS="" + export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + + # link fixups for compilation + rm -f ${S}/src/import/vendor/src + mkdir -p ${S}/src/import/vendor/ + ln -sf ./ ${S}/src/import/vendor/src + rm -rf ${S}/src/import/plugins + rm -rf ${S}/src/import/vendor/github.com/containernetworking/plugins + + mkdir -p ${S}/src/import/vendor/github.com/containernetworking/cni + + ln -sf ../../../../libcni ${S}/src/import/vendor/github.com/containernetworking/cni/libcni + ln -sf ../../../../pkg ${S}/src/import/vendor/github.com/containernetworking/cni/pkg + ln -sf ../../../../cnitool ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool + ln -sf ${WORKDIR}/plugins ${S}/src/import/vendor/github.com/containernetworking/plugins + + export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" + export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" + + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export CGO_ENABLED="1" + export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + + cd ${S}/src/import/vendor/github.com/containernetworking/cni/libcni + go build + + cd ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool + go build + + cd ${S}/src/import/vendor/github.com/containernetworking/plugins/ + PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/main/* | grep -v windows)" + mkdir -p ${WORKDIR}/plugins/bin/ + for p in $PLUGINS; do + plugin="$(basename "$p")" + echo "building: $p" + go build -o ${WORKDIR}/plugins/bin/$plugin github.com/containernetworking/plugins/$p + done +} + +do_install() { + localbindir="/opt/cni/bin" + + install -d ${D}${localbindir} + install -d ${D}/${sysconfdir}/cni/net.d + + install -m 755 ${S}/src/import/cnitool/cnitool ${D}/${localbindir} + install -m 755 -D ${WORKDIR}/plugins/bin/* ${D}/${localbindir} +} + +FILES_${PN} += "/opt/cni/bin/*" + +INHIBIT_PACKAGE_STRIP = "1" +INSANE_SKIP_${PN} += "ldflags already-stripped" + +deltask compile_ptest_base diff --git a/external/meta-virtualization/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch b/external/meta-virtualization/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch new file mode 100644 index 00000000..84fb9a43 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch @@ -0,0 +1,107 @@ +From 6576f228339b7931e05a8e861f085f483817806b Mon Sep 17 00:00:00 2001 +From: Paul Barker <pbarker@toganlabs.com> +Date: Tue, 8 May 2018 11:01:14 +0000 +Subject: [PATCH] Allow selection of go compiler + +By running `make GO=/path/to/go` we can now select the appropriate go compiler +to use. This also makes it possible to cross compile netns more easily. + +Signed-off-by: Paul Barker <pbarker@toganlabs.com> +Upstream-status: Pending +--- + Makefile | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/Makefile b/Makefile +index 3a22f3e..476cb9b 100644 +--- a/src/import/Makefile ++++ b/src/import/Makefile +@@ -23,6 +23,9 @@ CTIMEVAR=-X $(PKG)/version.GITCOMMIT=$(GITCOMMIT) -X $(PKG)/version.VERSION=$(VE + GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)" + GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static" + ++# Set our default go compiler ++GO := go ++ + # List the GOOS and GOARCH to build + GOOSARCHES = linux/arm linux/arm64 linux/amd64 linux/386 + +@@ -33,12 +36,12 @@ build: $(NAME) ## Builds a dynamic executable or package + + $(NAME): *.go VERSION.txt + @echo "+ $@" +- go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . ++ $(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . + + .PHONY: static + static: ## Builds a static executable + @echo "+ $@" +- CGO_ENABLED=0 go build \ ++ CGO_ENABLED=0 $(GO) build \ + -tags "$(BUILDTAGS) static_build" \ + ${GO_LDFLAGS_STATIC} -o $(NAME) . + +@@ -55,23 +58,23 @@ lint: ## Verifies `golint` passes + .PHONY: test + test: ## Runs the go tests + @echo "+ $@" +- @go test -v -tags "$(BUILDTAGS) cgo" $(shell go list ./... | grep -v vendor) ++ @$(GO) test -v -tags "$(BUILDTAGS) cgo" $(shell $(GO) list ./... | grep -v vendor) + + .PHONY: vet + vet: ## Verifies `go vet` passes + @echo "+ $@" +- @go vet $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr ++ @$(GO) vet $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr + + .PHONY: staticcheck + staticcheck: ## Verifies `staticcheck` passes + @echo "+ $@" +- @staticcheck $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr ++ @staticcheck $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr + + .PHONY: cover + cover: ## Runs go test with coverage + @echo "" > coverage.txt +- @for d in $(shell go list ./... | grep -v vendor); do \ +- go test -race -coverprofile=profile.out -covermode=atomic "$$d"; \ ++ @for d in $(shell $(GO) list ./... | grep -v vendor); do \ ++ $(GO) test -race -coverprofile=profile.out -covermode=atomic "$$d"; \ + if [ -f profile.out ]; then \ + cat profile.out >> coverage.txt; \ + rm profile.out; \ +@@ -81,11 +84,11 @@ cover: ## Runs go test with coverage + .PHONY: install + install: ## Installs the executable or package + @echo "+ $@" +- go install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} . ++ $(GO) install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} . + + define buildpretty + mkdir -p $(BUILDDIR)/$(1)/$(2); +-GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ ++GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ + -o $(BUILDDIR)/$(1)/$(2)/$(NAME) \ + -a -tags "$(BUILDTAGS) static_build netgo" \ + -installsuffix netgo ${GO_LDFLAGS_STATIC} .; +@@ -99,7 +102,7 @@ cross: *.go VERSION.txt ## Builds the cross-compiled binaries, creating a clean + $(foreach GOOSARCH,$(GOOSARCHES), $(call buildpretty,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) + + define buildrelease +-GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ ++GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ + -o $(BUILDDIR)/$(NAME)-$(1)-$(2) \ + -a -tags "$(BUILDTAGS) static_build netgo" \ + -installsuffix netgo ${GO_LDFLAGS_STATIC} .; +@@ -115,7 +118,7 @@ release: *.go VERSION.txt ## Builds the cross-compiled binaries, naming them in + .PHONY: bump-version + BUMP := patch + bump-version: ## Bump the version in the version file. Set BUMP to [ patch | major | minor ] +- @go get -u github.com/jessfraz/junk/sembump # update sembump tool ++ @$(GO) get -u github.com/jessfraz/junk/sembump # update sembump tool + $(eval NEW_VERSION = $(shell sembump --kind $(BUMP) $(VERSION))) + @echo "Bumping VERSION.txt from $(VERSION) to $(NEW_VERSION)" + echo $(NEW_VERSION) > VERSION.txt +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch b/external/meta-virtualization/recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch new file mode 100644 index 00000000..ed66e11b --- /dev/null +++ b/external/meta-virtualization/recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch @@ -0,0 +1,77 @@ +From d5c319bb61155d94bef2571a095d82983d786b94 Mon Sep 17 00:00:00 2001 +From: Paul Barker <pbarker@toganlabs.com> +Date: Fri, 13 Oct 2017 17:58:11 +0000 +Subject: [PATCH] Use correct go cross-compiler + +Signed-off-by: Paul Barker <pbarker@toganlabs.com> +Upstream-status: Pending +--- + Makefile | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Makefile b/Makefile +index cb9a46d..633f884 100644 +--- a/src/import/Makefile ++++ b/src/import/Makefile +@@ -33,12 +33,12 @@ build: $(NAME) ## Builds a dynamic executable or package + + $(NAME): *.go VERSION + @echo "+ $@" +- go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . ++ $(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . + + .PHONY: static + static: ## Builds a static executable + @echo "+ $@" +- CGO_ENABLED=0 go build \ ++ CGO_ENABLED=0 $(GO) build \ + -tags "$(BUILDTAGS) static_build" \ + ${GO_LDFLAGS_STATIC} -o $(NAME) . + +@@ -55,21 +55,21 @@ lint: ## Verifies `golint` passes + .PHONY: test + test: ## Runs the go tests + @echo "+ $@" +- @go test -v -tags "$(BUILDTAGS) cgo" $(shell go list ./... | grep -v vendor) ++ @$(GO) test -v -tags "$(BUILDTAGS) cgo" $(shell $(GO) list ./... | grep -v vendor) + + .PHONY: vet + vet: ## Verifies `go vet` passes + @echo "+ $@" +- @go vet $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr ++ @$(GO) vet $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr + + .PHONY: install + install: ## Installs the executable or package + @echo "+ $@" +- @go install . ++ @$(GO) install . + + define buildpretty + mkdir -p $(BUILDDIR)/$(1)/$(2); +-GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ ++GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ + -o $(BUILDDIR)/$(1)/$(2)/$(NAME) \ + -a -tags "$(BUILDTAGS) static_build netgo" \ + -installsuffix netgo ${GO_LDFLAGS_STATIC} .; +@@ -83,7 +83,7 @@ cross: *.go VERSION ## Builds the cross-compiled binaries, creating a clean dire + $(foreach GOOSARCH,$(GOOSARCHES), $(call buildpretty,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) + + define buildrelease +-GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ ++GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ + -o $(BUILDDIR)/$(NAME)-$(1)-$(2) \ + -a -tags "$(BUILDTAGS) static_build netgo" \ + -installsuffix netgo ${GO_LDFLAGS_STATIC} .; +@@ -99,7 +99,7 @@ release: *.go VERSION ## Builds the cross-compiled binaries, naming them in such + .PHONY: bump-version + BUMP := patch + bump-version: ## Bump the version in the version file. Set KIND to [ patch | major | minor ] +- @go get -u github.com/jessfraz/junk/sembump # update sembump tool ++ @$(GO) get -u github.com/jessfraz/junk/sembump # update sembump tool + $(eval NEW_VERSION = $(shell sembump --kind $(BUMP) $(VERSION))) + @echo "Bumping VERSION from $(VERSION) to $(NEW_VERSION)" + echo $(NEW_VERSION) > VERSION +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-networking/netns/netns_git.bb b/external/meta-virtualization/recipes-networking/netns/netns_git.bb new file mode 100644 index 00000000..b6d35948 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/netns/netns_git.bb @@ -0,0 +1,51 @@ +HOMEPAGE = "https://github.com/jfrazelle/netns" +SUMMARY = "Runc hook for setting up default bridge networking." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=48ef0979a2bcc3fae14ff30b8a7f5dbf" + +SRC_URI = "git://github.com/genuinetools/netns;branch=master \ + file://0001-Allow-selection-of-go-compiler.patch \ + " +SRCREV = "0da6ab0997707024debe68c91e940c9168041bf8" +PV = "0.4.0" +GO_IMPORT = "import" + +S = "${WORKDIR}/git" + +inherit goarch +inherit go + +EXTRA_OEMAKE = "GO='${GO}'" + +do_compile() { + export GOARCH="${TARGET_GOARCH}" + export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" + # Setup vendor directory so that it can be used in GOPATH. + # + # Go looks in a src directory under any directory in GOPATH but netns + # uses 'vendor' instead of 'vendor/src'. We can fix this with a symlink. + # + # We also need to link in the ipallocator and version directories as + # they are not under the src directory. + ln -sfn . "${S}/src/import/vendor/src" + mkdir -p "${S}/src/import/vendor/src/github.com/genuinetools/netns" + ln -sfn "${S}/src/import/ipallocator" "${S}/src/import/vendor/src/github.com/genuinetools/netns/ipallocator" + ln -sfn "${S}/src/import/version" "${S}/src/import/vendor/src/github.com/genuinetools/netns/version" + export GOPATH="${S}/src/import/vendor" + + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export CGO_ENABLED="1" + export CFLAGS="" + export LDFLAGS="" + export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + + cd ${S}/src/import + oe_runmake static +} + +do_install() { + install -d ${D}/${sbindir} + install ${S}/src/import/netns ${D}/${sbindir}/netns +} diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-add-ptest.patch b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-add-ptest.patch new file mode 100644 index 00000000..cb708dea --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-add-ptest.patch @@ -0,0 +1,68 @@ +Add test-install rule to support ptest execution + +Signed-off-by: Radu Patriu <radu.patriu@enea.com> + +Index: openvswitch-2.1.2/Makefile.am +=================================================================== +--- openvswitch-2.1.2.orig/Makefile.am ++++ openvswitch-2.1.2/Makefile.am +@@ -300,3 +300,5 @@ + include python/compat/automake.mk + include tutorial/automake.mk + include vtep/automake.mk ++include test.mk ++ +Index: openvswitch-2.1.2/test.mk +=================================================================== +--- /dev/null ++++ openvswitch-2.1.2/test.mk +@@ -0,0 +1,49 @@ ++TEST_DEST ?= ${prefix}/lib/openvswitch ++TEST_ROOT ?= ${prefix}/lib/openvswitch ++TEST_DEPEND = ++ ++if HAVE_OPENSSL ++TEST_DEPEND += $(TESTPKI_FILES) ++endif ++ ++test-install: $(TEST_DEPEND) ++ @list='$(noinst_PROGRAMS) $(EXTRA_DIST) $(dist_check_SCRIPTS) $(TEST_DEPEND) tests/atlocal tests/atconfig' ;\ ++ install -d $(TEST_DEST)/tests ;\ ++ install -d $(TEST_DEST)/python ;\ ++ install -d $(TEST_DEST)/python/ovs ;\ ++ install -d $(TEST_DEST)/python/ovs/db ;\ ++ install -d $(TEST_DEST)/python/ovs/unixctl ;\ ++ install -d $(TEST_DEST)/vswitchd ;\ ++ install vswitchd/vswitch.ovsschema $(TEST_DEST)/vswitchd ;\ ++ install -d $(TEST_DEST)/debian ;\ ++ install debian/ovs-monitor-ipsec $(TEST_DEST)/debian ;\ ++ install -d $(TEST_DEST)/build-aux ;\ ++ install build-aux/check-structs $(TEST_DEST)/build-aux ;\ ++ install -d $(TEST_DEST)/xenserver ;\ ++ install xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync $(TEST_DEST)/xenserver ;\ ++ install xenserver/opt_xensource_libexec_interface-reconfigure $(TEST_DEST)/xenserver ;\ ++ install xenserver/opt_xensource_libexec_InterfaceReconfigure.py $(TEST_DEST)/xenserver ;\ ++ install xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py $(TEST_DEST)/xenserver ;\ ++ install xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py $(TEST_DEST)/xenserver ;\ ++ install -d $(TEST_DEST)/vtep ;\ ++ install vtep/vtep.ovsschema $(TEST_DEST)/vtep ;\ ++ for p in $$list ; do \ ++ echo $$p ;\ ++ p=$${p#./} ;\ ++ pre=$${p#tests\/} ;\ ++ if test $$pre != $$p ; then \ ++ echo installing $$p to $(TEST_DEST)/tests/$$pre ;\ ++ install $$p $(TEST_DEST)/tests/$$pre ;\ ++ continue ;\ ++ fi ;\ ++ pre=$${p#python\/ovs\/} ;\ ++ if test $$pre != $$p ; then \ ++ echo installing $$p to $(TEST_DEST)/python/ovs/$$pre ;\ ++ install $$p $(TEST_DEST)/python/ovs/$$pre ;\ ++ continue ;\ ++ fi; \ ++ done ;\ ++ sed -i 's|abs_builddir=.*|abs_builddir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|abs_srcdir=.*|abs_srcdir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|abs_top_srcdir=.*|abs_top_srcdir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|abs_top_builddir=.*|abs_top_builddir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-example b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-example new file mode 100644 index 00000000..6f08c3fa --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-example @@ -0,0 +1,102 @@ +#! /bin/sh +# +# Copyright (C) 2011 Nicira Networks, Inc. +# +# 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. +# +### BEGIN INIT INFO +# Provides: openvswitch-switch +# Required-Start: $network $named $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Open vSwitch switch +### END INIT INFO + +(test -x /usr/sbin/ovs-vswitchd && test -x /usr/sbin/ovsdb-server) || exit 0 + +. /usr/share/openvswitch/scripts/ovs-lib +test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch + +if test X"$BRCOMPAT" = Xyes && test ! -x /usr/sbin/ovs-brcompatd; then + BRCOMPAT=no + log_warning_msg "ovs-brcompatd missing, disabling bridge compatibility" +fi + +ovs_ctl () { + set /usr/share/openvswitch/scripts/ovs-ctl "$@" + if test X"$BRCOMPAT" = Xyes; then + set "$@" --brcompat + fi + "$@" +} + +load_kmod () { + ovs_ctl load-kmod || exit $? +} + +start () { + if ovs_ctl load-kmod; then + : + else + echo "Module has probably not been built for this kernel." + if ! test -d /usr/share/doc/openvswitch-datapath-source; then + echo "Install the openvswitch-datapath-source package, then read" + else + echo "For instructions, read" + fi + echo "/usr/share/doc/openvswitch-datapath-source/README.Debian" + fi + set ovs_ctl ${1-start} --system-id=random + if test X"$FORCE_COREFILES" != X; then + set "$@" --force-corefiles="$FORCE_COREFILES" + fi + "$@" || exit $? + + ovs_ctl --protocol=gre enable-protocol +} + +stop () { + ovs_ctl stop +} + +case $1 in + start) + start + ;; + stop | force-stop) + stop + ;; + reload | force-reload) + # The OVS daemons keep up-to-date. + ;; + restart) + stop + start + ;; + status) + ovs_ctl status + ;; + force-reload-kmod) + start force-reload-kmod + ;; + load-kmod) + load_kmod + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload|status|force-stop|force-reload-kmod|load-kmod}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-switch b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-switch new file mode 100644 index 00000000..6f08c3fa --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-switch @@ -0,0 +1,102 @@ +#! /bin/sh +# +# Copyright (C) 2011 Nicira Networks, Inc. +# +# 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. +# +### BEGIN INIT INFO +# Provides: openvswitch-switch +# Required-Start: $network $named $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Open vSwitch switch +### END INIT INFO + +(test -x /usr/sbin/ovs-vswitchd && test -x /usr/sbin/ovsdb-server) || exit 0 + +. /usr/share/openvswitch/scripts/ovs-lib +test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch + +if test X"$BRCOMPAT" = Xyes && test ! -x /usr/sbin/ovs-brcompatd; then + BRCOMPAT=no + log_warning_msg "ovs-brcompatd missing, disabling bridge compatibility" +fi + +ovs_ctl () { + set /usr/share/openvswitch/scripts/ovs-ctl "$@" + if test X"$BRCOMPAT" = Xyes; then + set "$@" --brcompat + fi + "$@" +} + +load_kmod () { + ovs_ctl load-kmod || exit $? +} + +start () { + if ovs_ctl load-kmod; then + : + else + echo "Module has probably not been built for this kernel." + if ! test -d /usr/share/doc/openvswitch-datapath-source; then + echo "Install the openvswitch-datapath-source package, then read" + else + echo "For instructions, read" + fi + echo "/usr/share/doc/openvswitch-datapath-source/README.Debian" + fi + set ovs_ctl ${1-start} --system-id=random + if test X"$FORCE_COREFILES" != X; then + set "$@" --force-corefiles="$FORCE_COREFILES" + fi + "$@" || exit $? + + ovs_ctl --protocol=gre enable-protocol +} + +stop () { + ovs_ctl stop +} + +case $1 in + start) + start + ;; + stop | force-stop) + stop + ;; + reload | force-reload) + # The OVS daemons keep up-to-date. + ;; + restart) + stop + start + ;; + status) + ovs_ctl status + ;; + force-reload-kmod) + start force-reload-kmod + ;; + load-kmod) + load_kmod + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload|status|force-stop|force-reload-kmod|load-kmod}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-switch-setup b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-switch-setup new file mode 100644 index 00000000..73387fbc --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-switch-setup @@ -0,0 +1,8 @@ +# This is a POSIX shell fragment -*- sh -*- + +# FORCE_COREFILES: If 'yes' then core files will be enabled. +# FORCE_COREFILES=yes + +# BRCOMPAT: If 'yes' and the openvswitch-brcompat package is installed, then +# Linux bridge compatibility will be enabled. +# BRCOMPAT=yes diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-testcontroller b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-testcontroller new file mode 100755 index 00000000..aad5ad60 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-testcontroller @@ -0,0 +1,274 @@ +#!/bin/sh +# +# Copyright (c) 2011 Nicira Networks Inc. +# Copyright (c) 2007, 2009 Javier Fernandez-Sanguino <jfs@debian.org> +# +# This is free software; you may redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, +# or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License with +# the Debian operating system, in /usr/share/common-licenses/GPL; if +# not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA +# +### BEGIN INIT INFO +# Provides: openvswitch-testcontroller +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $remote_fs +# Should-Start: $named +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Open vSwitch controller +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +DAEMON=/usr/bin/ovs-testcontroller # Introduce the server's location here +NAME=ovs-testcontroller # Introduce the short server's name here +DESC=ovs-testcontroller # Introduce a short description here +LOGDIR=/var/log/openvswitch # Log directory to use + +PIDFILE=/var/run/openvswitch/$NAME.pid + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +# Default options, these can be overriden by the information +# at /etc/default/openvswitch-testcontroller +DAEMON_OPTS="" # Additional options given to the server + +DODTIME=10 # Time to wait for the server to die, in seconds + # If this value is set too low you might not + # let some servers to die gracefully and + # 'restart' will not work + +LOGFILE=$LOGDIR/$NAME.log # Server logfile +#DAEMONUSER= # User to run the daemons as. If this value + # is set start-stop-daemon will chuid the server + +# Include defaults if available +default=/etc/default/openvswitch-testcontroller +if [ -f $default ] ; then + . $default +fi + +# Check that the user exists (if we set a user) +# Does the user exist? +if [ -n "$DAEMONUSER" ] ; then + if getent passwd | grep -q "^$DAEMONUSER:"; then + # Obtain the uid and gid + DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'` + DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'` + else + log_failure_msg "The user $DAEMONUSER, required to run $NAME does not exist." + exit 1 + fi +fi + + +set -e + +running_pid() { +# Check if a given process pid's cmdline matches a given name + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1` + # Is this the expected server + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() { +# Check if the process is running looking at /proc +# (works for all users) + + # No pidfile, probably no daemon present + [ ! -f "$PIDFILE" ] && return 1 + pid=`cat $PIDFILE` + running_pid $pid $DAEMON || return 1 + return 0 +} + +start_server() { + if [ -z "$LISTEN" ]; then + echo "$default: No connection methods configured, controller disabled" >&2 + exit 0 + fi + + if [ ! -d /var/run/openvswitch ]; then + install -d -m 755 -o root -g root /var/run/openvswitch + fi + + SSL_OPTS= + case $LISTEN in + *ssl*) + : ${PRIVKEY:=/etc/openvswitch-testcontroller/privkey.pem} + : ${CERT:=/etc/openvswitch-testcontroller/cert.pem} + : ${CACERT:=/etc/openvswitch-testcontroller/cacert.pem} + if test ! -e "$PRIVKEY" || test ! -e "$CERT" || + test ! -e "$CACERT"; then + if test ! -e "$PRIVKEY"; then + echo "$PRIVKEY: private key missing" >&2 + fi + if test ! -e "$CERT"; then + echo "$CERT: certificate for private key missing" >&2 + fi + if test ! -e "$CACERT"; then + echo "$CACERT: CA certificate missing" >&2 + fi + exit 1 + fi + SSL_OPTS="--private-key=$PRIVKEY --certificate=$CERT --ca-cert=$CACERT" + ;; + esac + +# Start the process using the wrapper + if [ -z "$DAEMONUSER" ] ; then + start-stop-daemon --start --pidfile $PIDFILE \ + --exec $DAEMON -- --detach --pidfile=$PIDFILE \ + $LISTEN $DAEMON_OPTS $SSL_OPTS + errcode=$? + else +# if we are using a daemonuser then change the user id + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --chuid $DAEMONUSER --exec $DAEMON -- \ + --detach --pidfile=$PIDFILE $LISTEN $DAEMON_OPTS \ + $SSL_OPTS + errcode=$? + fi + return $errcode +} + +stop_server() { +# Stop the process using the wrapper + if [ -z "$DAEMONUSER" ] ; then + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON + errcode=$? + else +# if we are using a daemonuser then look for process that match + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --user $DAEMONUSER --exec $DAEMON + errcode=$? + fi + + return $errcode +} + +reload_server() { + [ ! -f "$PIDFILE" ] && return 1 + pid=`cat $PIDFILE` # This is the daemon's pid + # Send a SIGHUP + kill -1 $pid + return $? +} + +force_stop() { +# Force the process to die killing it manually + [ ! -e "$PIDFILE" ] && return + if running ; then + kill -15 $pid + # Is it really dead? + sleep "$DODTIME" + if running ; then + kill -9 $pid + sleep "$DODTIME" + if running ; then + echo "Cannot kill $NAME (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE +} + + +case "$1" in + start) + log_begin_msg "Starting $DESC " "$NAME" + # Check if it's running first + if running ; then + log_warning_msg "apparently already running" + log_end_msg 0 + exit 0 + fi + if start_server && running ; then + # It's ok, the server started and is running + log_end_msg 0 + else + # Either we could not start it or it is not running + # after we did + # NOTE: Some servers might die some time after they start, + # this code does not try to detect this and might give + # a false positive (use 'status' for that) + log_end_msg 1 + fi + ;; + stop) + log_begin_msg "Stopping $DESC" "$NAME" + if running ; then + # Only stop the server if we see it running + stop_server + log_end_msg $? + else + # If it's not running don't do anything + log_warning_msg "apparently not running" + log_end_msg 0 + exit 0 + fi + ;; + force-stop) + # First try to stop gracefully the program + $0 stop + if running; then + # If it's still running try to kill it more forcefully + log_begin_msg "Stopping (force) $DESC" "$NAME" + force_stop + log_end_msg $? + fi + ;; + restart|force-reload) + log_begin_msg "Restarting $DESC" "$NAME" + stop_server + # Wait some sensible amount, some server need this + [ -n "$DODTIME" ] && sleep $DODTIME + start_server + running + log_end_msg $? + ;; + status) + + log_begin_msg "Checking status of $DESC" "$NAME" + if running ; then + log_begin_msg "running" + log_end_msg 0 + else + log_warning_msg "apparently not running" + log_end_msg 1 + exit 1 + fi + ;; + # Use this if the daemon cannot reload + reload) + log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon" + log_warning_msg "cannot re-read the config file (use restart)." + ;; + *) + N=/etc/init.d/openvswitch-testcontroller + echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-testcontroller-setup b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-testcontroller-setup new file mode 100644 index 00000000..b431ece5 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/openvswitch-testcontroller-setup @@ -0,0 +1,29 @@ +# This is a POSIX shell fragment -*- sh -*- + +# LISTEN: What OpenFlow connection methods should the controller listen on? +# +# This is a space-delimited list of connection methods: +# +# * "pssl:[PORT]": Listen for SSL connections on the specified PORT +# (default: 6633). The private key, certificate, and CA certificate +# must be specified below. +# +# * "pctp:[PORT]": Listen for TCP connections on the specified PORT +# (default: 6633). Not recommended for security reasons. +# +LISTEN="pssl:" + +# PRIVKEY: Name of file containing controller's private key. +# Required if SSL enabled. +PRIVKEY=/etc/openvswitch-testcontroller/privkey.pem + +# CERT: Name of file containing certificate for private key. +# Required if SSL enabled. +CERT=/etc/openvswitch-testcontroller/cert.pem + +# CACERT: Name of file containing switch CA certificate. +# Required if SSL enabled. +CACERT=/etc/openvswitch-testcontroller/cacert.pem + +# Additional options to pass to controller, e.g. "--hub" +DAEMON_OPTS="" diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch b/external/meta-virtualization/recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch new file mode 100644 index 00000000..0dc6b11b --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch @@ -0,0 +1,372 @@ +From a0a2d829642e916bd5d1c498a3e6f3641ed717a0 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Fri, 13 Jan 2017 16:12:55 -0500 +Subject: [PATCH] python: make remaining scripts use /usr/bin/env + +Unfortunately there is no concept of a host python vs. target python +to facilitate cross compilation. There is only one PYTHON variable and +this is used during building and in the header of python scripts after +installation. The best approach for cross compilation is to thus to +ensure python is in the path and avoid passing a path as part of +PYTHON. To make this function smoothly all installed scripts should +make use of /usr/bin/env to increase the chances of finding python. + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + build-aux/check-structs | 2 +- + build-aux/dpdkstrip.py | 2 +- + build-aux/extract-ofp-actions | 2 +- + build-aux/extract-ofp-errors | 2 +- + build-aux/extract-ofp-fields | 2 +- + build-aux/extract-ofp-msgs | 2 +- + build-aux/sodepends.py | 2 +- + build-aux/soexpand.py | 2 +- + build-aux/text2c | 2 +- + build-aux/xml2nroff | 2 +- + ovn/utilities/ovn-detrace.in | 2 +- + ovn/utilities/ovn-docker-overlay-driver.in | 2 +- + ovn/utilities/ovn-docker-underlay-driver.in | 2 +- + ovsdb/dot2pic | 2 +- + ovsdb/ovsdb-doc | 2 +- + ovsdb/ovsdb-dot.in | 2 +- + ovsdb/ovsdb-idlc.in | 2 +- + python/build/soutil.py | 2 +- + tests/flowgen.py | 2 +- + tests/ovsdb-monitor-sort.py | 2 +- + tests/uuidfilt.py | 2 +- + utilities/bugtool/ovs-bugtool.in | 2 +- + utilities/ovs-check-dead-ifs.in | 2 +- + utilities/ovs-dpctl-top.in | 2 +- + utilities/ovs-l3ping.in | 2 +- + utilities/ovs-parse-backtrace.in | 2 +- + utilities/ovs-pcap.in | 2 +- + utilities/ovs-tcpdump.in | 2 +- + utilities/ovs-tcpundump.in | 2 +- + utilities/ovs-test.in | 2 +- + utilities/ovs-vlan-test.in | 2 +- + vtep/ovs-vtep.in | 2 +- + 32 files changed, 32 insertions(+), 32 deletions(-) + +diff --git a/build-aux/check-structs b/build-aux/check-structs +index 37ffa06..eb44c91 100755 +--- a/build-aux/check-structs ++++ b/build-aux/check-structs +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + import os.path + import sys +diff --git a/build-aux/dpdkstrip.py b/build-aux/dpdkstrip.py +index 48c7f06..b8b8ba9 100755 +--- a/build-aux/dpdkstrip.py ++++ b/build-aux/dpdkstrip.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + # Copyright (c) 2017 Red Hat, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/build-aux/extract-ofp-actions b/build-aux/extract-ofp-actions +index bd7131f..4d05ef9 100755 +--- a/build-aux/extract-ofp-actions ++++ b/build-aux/extract-ofp-actions +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + import sys + import os.path +diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors +index 71ae0bd..58ba006 100755 +--- a/build-aux/extract-ofp-errors ++++ b/build-aux/extract-ofp-errors +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + import sys + import os.path +diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields +index 184b75e..cf339f8 100755 +--- a/build-aux/extract-ofp-fields ++++ b/build-aux/extract-ofp-fields +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + import getopt + import sys +diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs +index a67e870..92c4bda 100755 +--- a/build-aux/extract-ofp-msgs ++++ b/build-aux/extract-ofp-msgs +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + import sys + import os.path +diff --git a/build-aux/sodepends.py b/build-aux/sodepends.py +index 90cfaa0..45812bc 100755 +--- a/build-aux/sodepends.py ++++ b/build-aux/sodepends.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Copyright (c) 2008, 2011, 2017 Nicira, Inc. + # +diff --git a/build-aux/soexpand.py b/build-aux/soexpand.py +index 53ca640..00adcf4 100755 +--- a/build-aux/soexpand.py ++++ b/build-aux/soexpand.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Copyright (c) 2008, 2017 Nicira, Inc. + # +diff --git a/build-aux/text2c b/build-aux/text2c +index cb1f256..ab7910e 100755 +--- a/build-aux/text2c ++++ b/build-aux/text2c +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + import re + import sys +diff --git a/build-aux/xml2nroff b/build-aux/xml2nroff +index bd4e879..db45c56 100755 +--- a/build-aux/xml2nroff ++++ b/build-aux/xml2nroff +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + # Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. + # +diff --git a/ovn/utilities/ovn-detrace.in b/ovn/utilities/ovn-detrace.in +index e2e5b4c..5549219 100755 +--- a/ovn/utilities/ovn-detrace.in ++++ b/ovn/utilities/ovn-detrace.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Copyright (c) 2017 eBay Inc. + # +diff --git a/ovn/utilities/ovn-docker-overlay-driver.in b/ovn/utilities/ovn-docker-overlay-driver.in +index 65edfcd..895426b 100755 +--- a/ovn/utilities/ovn-docker-overlay-driver.in ++++ b/ovn/utilities/ovn-docker-overlay-driver.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # Copyright (C) 2015 Nicira, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/ovn/utilities/ovn-docker-underlay-driver.in b/ovn/utilities/ovn-docker-underlay-driver.in +index d91ce9f..e0c8db6 100755 +--- a/ovn/utilities/ovn-docker-underlay-driver.in ++++ b/ovn/utilities/ovn-docker-underlay-driver.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # Copyright (C) 2015 Nicira, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic +index de67261..174e723 100755 +--- a/ovsdb/dot2pic ++++ b/ovsdb/dot2pic +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc. + # +diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc +index 406c293..d55c6e6 100755 +--- a/ovsdb/ovsdb-doc ++++ b/ovsdb/ovsdb-doc +@@ -1,4 +1,4 @@ +-#! /usr/bin/python ++#! /usr/bin/env python3 + + # Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. + # +diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in +index 8eea617..38ba33a 100755 +--- a/ovsdb/ovsdb-dot.in ++++ b/ovsdb/ovsdb-dot.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#! /usr/bin/env @PYTHON@ + + from datetime import date + import ovs.db.error +diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in +index 1ea2115..4ecb2e2 100755 +--- a/ovsdb/ovsdb-idlc.in ++++ b/ovsdb/ovsdb-idlc.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + + from __future__ import print_function + import getopt +diff --git a/python/build/soutil.py b/python/build/soutil.py +index b8027af..8f52803 100755 +--- a/python/build/soutil.py ++++ b/python/build/soutil.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Copyright (c) 2008, 2017 Nicira, Inc. + # +diff --git a/tests/flowgen.py b/tests/flowgen.py +index 221a8f2..5d96d76 100755 +--- a/tests/flowgen.py ++++ b/tests/flowgen.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Copyright (c) 2009, 2010, 2011, 2012, 2015, 2017 Nicira, Inc. + # +diff --git a/tests/ovsdb-monitor-sort.py b/tests/ovsdb-monitor-sort.py +index 7d368a7..ab4c38c 100755 +--- a/tests/ovsdb-monitor-sort.py ++++ b/tests/ovsdb-monitor-sort.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Breaks lines read from stdin into groups using blank lines as + # group separators, then sorts lines within the groups for +diff --git a/tests/uuidfilt.py b/tests/uuidfilt.py +index ea72812..f1a9aff 100755 +--- a/tests/uuidfilt.py ++++ b/tests/uuidfilt.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + import re + import sys +diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in +index 8d220fd..76cedf4 100755 +--- a/utilities/bugtool/ovs-bugtool.in ++++ b/utilities/bugtool/ovs-bugtool.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#! /usr/bin/env @PYTHON@ + + # This library is free software; you can redistribute it and/or + # modify it under the terms of version 2.1 of the GNU Lesser General Public +diff --git a/utilities/ovs-check-dead-ifs.in b/utilities/ovs-check-dead-ifs.in +index ac54f6c..13d86b3 100755 +--- a/utilities/ovs-check-dead-ifs.in ++++ b/utilities/ovs-check-dead-ifs.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + + import os + import re +diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in +index 7f0f1f8..ece707a 100755 +--- a/utilities/ovs-dpctl-top.in ++++ b/utilities/ovs-dpctl-top.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Copyright (c) 2013 Nicira, Inc. + # +diff --git a/utilities/ovs-l3ping.in b/utilities/ovs-l3ping.in +index 1b07972..9852699 100644 +--- a/utilities/ovs-l3ping.in ++++ b/utilities/ovs-l3ping.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. +diff --git a/utilities/ovs-parse-backtrace.in b/utilities/ovs-parse-backtrace.in +index 350cbd9..1960fb4 100755 +--- a/utilities/ovs-parse-backtrace.in ++++ b/utilities/ovs-parse-backtrace.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Copyright (c) 2012 Nicira, Inc. + # +diff --git a/utilities/ovs-pcap.in b/utilities/ovs-pcap.in +index fc15321..bd55a41 100755 +--- a/utilities/ovs-pcap.in ++++ b/utilities/ovs-pcap.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Copyright (c) 2010 Nicira, Inc. + # +diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in +index 91fa14e..bad67b7 100755 +--- a/utilities/ovs-tcpdump.in ++++ b/utilities/ovs-tcpdump.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Copyright (c) 2016 Red Hat, Inc. + # +diff --git a/utilities/ovs-tcpundump.in b/utilities/ovs-tcpundump.in +index c99015b..9a617ce 100755 +--- a/utilities/ovs-tcpundump.in ++++ b/utilities/ovs-tcpundump.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Copyright (c) 2010 Nicira, Inc. + # +diff --git a/utilities/ovs-test.in b/utilities/ovs-test.in +index fb1f9ad..4dba169 100644 +--- a/utilities/ovs-test.in ++++ b/utilities/ovs-test.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. +diff --git a/utilities/ovs-vlan-test.in b/utilities/ovs-vlan-test.in +index e229498..5b70118 100755 +--- a/utilities/ovs-vlan-test.in ++++ b/utilities/ovs-vlan-test.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # + # Copyright (c) 2010 Nicira, Inc. + # +diff --git a/vtep/ovs-vtep.in b/vtep/ovs-vtep.in +index 98748e4..3f12ae2 100755 +--- a/vtep/ovs-vtep.in ++++ b/vtep/ovs-vtep.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#!/usr/bin/env @PYTHON@ + # Copyright (C) 2013 Nicira, Inc. All Rights Reserved. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/python-switch-remaining-scripts-to-use-python3.patch b/external/meta-virtualization/recipes-networking/openvswitch/files/python-switch-remaining-scripts-to-use-python3.patch new file mode 100644 index 00000000..64e0e3f4 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/python-switch-remaining-scripts-to-use-python3.patch @@ -0,0 +1,100 @@ +From 098d3927e928362f0ac60ea97e9c39b73871be21 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Wed, 3 May 2017 10:39:12 -0400 +Subject: [PATCH] python: switch remaining scripts to use python3 + +Work to remove the main openvswitch package's dependency on python 2. + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> + +--- + ofproto/ipfix-gen-entities | 2 +- + tests/test-l7.py | 2 +- + utilities/checkpatch.py | 2 +- + utilities/ovs-dev.py | 2 +- + utilities/ovs-pipegen.py | 2 +- + xenserver/etc_xapi.d_plugins_openvswitch-cfg-update | 2 +- + xenserver/opt_xensource_libexec_interface-reconfigure | 2 +- + xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities +index 0be7199..d2cce42 100755 +--- a/ofproto/ipfix-gen-entities ++++ b/ofproto/ipfix-gen-entities +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + # + # Copyright (C) 2012 Nicira, Inc. + # +diff --git a/tests/test-l7.py b/tests/test-l7.py +index d7854a1..f09defb 100755 +--- a/tests/test-l7.py ++++ b/tests/test-l7.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright (c) 2015, 2016 Nicira, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py +index f929714..e17a1cf 100755 +--- a/utilities/checkpatch.py ++++ b/utilities/checkpatch.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright (c) 2016, 2017 Red Hat, Inc. + # Copyright (c) 2018 Nicira, Inc. + # +diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py +index 9ce0f04..839e13e 100755 +--- a/utilities/ovs-dev.py ++++ b/utilities/ovs-dev.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright (c) 2013, 2014, 2015, 2016 Nicira, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/utilities/ovs-pipegen.py b/utilities/ovs-pipegen.py +index ee57972..e9b99f5 100755 +--- a/utilities/ovs-pipegen.py ++++ b/utilities/ovs-pipegen.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + # Copyright (c) 2013, 2014, 2015 Nicira, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update +index e7404e3..5edad76 100755 +--- a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update ++++ b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # xapi plugin script to update the cache of configuration items in the + # ovs-vswitchd configuration that are managed in the xapi database when +diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure +index a82043f..9c20725 100755 +--- a/xenserver/opt_xensource_libexec_interface-reconfigure ++++ b/xenserver/opt_xensource_libexec_interface-reconfigure +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright (c) 2008,2009 Citrix Systems, Inc. + # +diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync +index ecd6f6d..b8f2a42 100755 +--- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync ++++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + # Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/external/meta-virtualization/recipes-networking/openvswitch/files/run-ptest b/external/meta-virtualization/recipes-networking/openvswitch/files/run-ptest new file mode 100644 index 00000000..dd067076 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/files/run-ptest @@ -0,0 +1,4 @@ +#!/bin/sh + +./tests/testsuite --am-fmt -C tests AUTOTEST_PATH=utilities:vswitchd:ovsdb:tests + diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/0002-Define-WAIT_ANY-if-not-provided-by-system.patch b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/0002-Define-WAIT_ANY-if-not-provided-by-system.patch new file mode 100644 index 00000000..f997bbff --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/0002-Define-WAIT_ANY-if-not-provided-by-system.patch @@ -0,0 +1,29 @@ +From 801023e72b31e7c49cbccedd76ade33a17fcbe45 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 20 Mar 2017 12:13:30 -0700 +Subject: [PATCH] Define WAIT_ANY if not provided by system + +POSIX does not define it and uses -1 directly +some libc do not have this definitions + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- + tests/test-ovn.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tests/test-ovn.c b/tests/test-ovn.c +index 84adf81..2bc6bdf 100644 +--- a/tests/test-ovn.c ++++ b/tests/test-ovn.c +@@ -38,6 +38,10 @@ + #include "simap.h" + #include "util.h" + ++#ifndef WAIT_ANY ++# define WAIT_ANY (-1) /* Any process. */ ++#endif ++ + /* --relops: Bitmap of the relational operators to test, in exhaustive test. */ + static unsigned int test_relops; + diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/disable_m4_check.patch b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/disable_m4_check.patch new file mode 100644 index 00000000..711a1487 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/disable_m4_check.patch @@ -0,0 +1,24 @@ +From f675d7209f999ce80cb4249c4ebb216697387b71 Mon Sep 17 00:00:00 2001 +From: Amy Fong <amy.fong@windriver.com> +Date: Thu, 29 Jan 2015 09:56:03 -0500 +Subject: [PATCH] Disable m4 file test where sources are built from git. + +Signed-off-by: Amy Fong <amy.fong@windriver.com> + +--- + Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index ff7d70a..2fc1f13 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -187,7 +187,7 @@ CLEAN_LOCAL += clean-pycov + + # If we're checked out from a Git repository, make sure that every + # file that is in Git is distributed. +-ALL_LOCAL += dist-hook-git ++# ALL_LOCAL += dist-hook-git + dist-hook-git: distfiles + @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \ + (cd datapath && $(MAKE) distfiles); \ diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/kernel_module.patch b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/kernel_module.patch new file mode 100644 index 00000000..c177202f --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/kernel_module.patch @@ -0,0 +1,26 @@ +From adfd2380d71dff1a31efaf63cf7ac97470466ec9 Mon Sep 17 00:00:00 2001 +From: Amy Fong <amy.fong@windriver.com> +Date: Thu, 29 Jan 2015 09:56:03 -0500 +Subject: [PATCH] Specify install path for kernel module + +Signed-off-by: Amy Fong <amy.fong@windriver.com> + +--- + datapath/linux/Makefile.main.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/datapath/linux/Makefile.main.in b/datapath/linux/Makefile.main.in +index 7d18253..63c520f 100644 +--- a/datapath/linux/Makefile.main.in ++++ b/datapath/linux/Makefile.main.in +@@ -71,8 +71,8 @@ default: + $(MAKE) -C $(KSRC) M=$(builddir) modules + + modules_install: +- $(MAKE) -C $(KSRC) M=$(builddir) modules_install +- depmod `sed -n 's/#define UTS_RELEASE "\([^"]*\)"/\1/p' $(KSRC)/include/generated/utsrelease.h` ++ $(MAKE) -C $(KSRC) M=$(builddir) modules_install INSTALL_MOD_PATH=${INSTALL_MOD_PATH} ++ # depmod `sed -n 's/#define UTS_RELEASE "\([^"]*\)"/\1/p' $(KSRC)/include/generated/utsrelease.h` + endif + + # Much of the kernel build system in this file is derived from Intel's diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/openvswitch-add-ptest-5563e309b80bbea9bff538e71ecfd7e5e538bab9.patch b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/openvswitch-add-ptest-5563e309b80bbea9bff538e71ecfd7e5e538bab9.patch new file mode 100644 index 00000000..a8fc86c9 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/openvswitch-add-ptest-5563e309b80bbea9bff538e71ecfd7e5e538bab9.patch @@ -0,0 +1,110 @@ +From 37df262d2b0f0b8c177aa850623f2c5880484ff0 Mon Sep 17 00:00:00 2001 +From: He Zhe <zhe.he@windriver.com> +Date: Wed, 30 Mar 2016 06:23:45 -0400 +Subject: [PATCH] openvswitch: Add test-install rule to support ptest execution + +Signed-off-by: Radu Patriu <radu.patriu@enea.com> + +Fix ptest for v2.5 + - Copy certain files from srcdir since it has been different from + build directory. + - Copy more necessary files for new added test cases. + - Modify config files for running on target. + +Signed-off-by: He Zhe <zhe.he@windriver.com> + +--- + Makefile.am | 1 + + test.mk | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 75 insertions(+) + create mode 100644 test.mk + +diff --git a/Makefile.am b/Makefile.am +index 7889728..6435399 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -494,3 +494,4 @@ include windows/automake.mk + include ovn/automake.mk + include selinux/automake.mk + include build-aux/automake.mk ++include test.mk +diff --git a/test.mk b/test.mk +new file mode 100644 +index 0000000..0b4587c +--- /dev/null ++++ b/test.mk +@@ -0,0 +1,74 @@ ++TEST_DEST ?= ${prefix}/lib/openvswitch ++TEST_ROOT ?= ${prefix}/lib/openvswitch ++TEST_DEPEND = ++ ++if HAVE_OPENSSL ++TEST_DEPEND += $(TESTPKI_FILES) ++endif ++ ++test-install: $(TEST_DEPEND) ++ @list='$(noinst_PROGRAMS) $(EXTRA_DIST) $(dist_check_SCRIPTS) $(TEST_DEPEND) tests/atlocal tests/atconfig' ;\ ++ install -d $(TEST_DEST)/tests ;\ ++ install $(srcdir)/vtep/ovs-vtep $(TEST_DEST)/tests ;\ ++ install -d $(TEST_DEST)/python ;\ ++ install -d $(TEST_DEST)/python/ovs ;\ ++ install -d $(TEST_DEST)/python/ovs/db ;\ ++ install -d $(TEST_DEST)/python/ovs/compat ;\ ++ install -d $(TEST_DEST)/python/ovs/compat/sortedcontainers ;\ ++ install -d $(TEST_DEST)/python/ovs/unixctl ;\ ++ install -d $(TEST_DEST)/vswitchd ;\ ++ install $(srcdir)/vswitchd/vswitch.ovsschema $(TEST_DEST)/vswitchd ;\ ++ install vswitchd/ovs-vswitchd $(TEST_DEST)/vswitchd ;\ ++ install -d $(TEST_DEST)/debian ;\ ++ install $(srcdir)/debian/ovs-monitor-ipsec $(TEST_DEST)/debian ;\ ++ install -d $(TEST_DEST)/build-aux ;\ ++ install $(srcdir)/build-aux/check-structs $(TEST_DEST)/build-aux ;\ ++ install -d $(TEST_DEST)/xenserver ;\ ++ install $(srcdir)/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync $(TEST_DEST)/xenserver ;\ ++ install $(srcdir)/xenserver/opt_xensource_libexec_interface-reconfigure $(TEST_DEST)/xenserver ;\ ++ install $(srcdir)/xenserver/opt_xensource_libexec_InterfaceReconfigure.py $(TEST_DEST)/xenserver ;\ ++ install $(srcdir)/xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py $(TEST_DEST)/xenserver ;\ ++ install $(srcdir)/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py $(TEST_DEST)/xenserver ;\ ++ install -d $(TEST_DEST)/vtep ;\ ++ install $(srcdir)/vtep/vtep.ovsschema $(TEST_DEST)/vtep ;\ ++ install -d $(TEST_DEST)/ovn ;\ ++ install $(srcdir)/ovn/ovn-nb.ovsschema $(TEST_DEST)/ovn ;\ ++ install $(srcdir)/ovn/ovn-sb.ovsschema $(TEST_DEST)/ovn ;\ ++ install -d $(TEST_DEST)/utilities ;\ ++ install $(srcdir)/utilities/ovs-pcap.in $(TEST_DEST)/utilities ;\ ++ install $(srcdir)/utilities/ovs-pki.in $(TEST_DEST)/utilities ;\ ++ for p in $$list ; do \ ++ echo $$p ;\ ++ p=$${p#../git/} ;\ ++ pre=$${p#tests\/} ;\ ++ if test $$pre != $$p ; then \ ++ echo installing $$p to $(TEST_DEST)/tests/$$pre ;\ ++ if test -f $$p ; then \ ++ install $$p $(TEST_DEST)/tests/$$pre ;\ ++ else \ ++ install $(srcdir)/$$p $(TEST_DEST)/tests/$$pre ;\ ++ fi ;\ ++ continue ;\ ++ fi ;\ ++ pre=$${p#python\/ovs\/} ;\ ++ if test $$pre != $$p ; then \ ++ echo installing $$p to $(TEST_DEST)/python/ovs/$$pre ;\ ++ if test -f $$p ; then \ ++ install $$p $(TEST_DEST)/python/ovs/$$pre ;\ ++ else \ ++ install $(srcdir)/$$p $(TEST_DEST)/python/ovs/$$pre ;\ ++ fi ;\ ++ continue ;\ ++ fi; \ ++ done ;\ ++ sed -i 's|abs_builddir=.*|abs_builddir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|abs_srcdir=.*|abs_srcdir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|abs_top_srcdir=.*|abs_top_srcdir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|abs_top_builddir=.*|abs_top_builddir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|at_srcdir=.*|at_srcdir='"'"'.'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|at_top_srcdir=.*|at_top_srcdir='"'"'..'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|at_top_build_prefix=.*|at_top_build_prefix='"'"'../'"'"'|g' $(TEST_DEST)/tests/atconfig ++ sed -i 's|^\(.*config\.log.*\)|#\1|g' $(TEST_DEST)/tests/testsuite ++ sed -i 's|$$srcdir|$$abs_srcdir|g' $(TEST_DEST)/tests/testsuite ++ sed -i 's|ovs-appctl-bashcomp\.bash|/etc/bash_completion.d/ovs-appctl-bashcomp\.bash|g' $(TEST_DEST)/tests/testsuite ++ sed -i 's|ovs-vsctl-bashcomp\.bash|/etc/bash_completion.d/ovs-vsctl-bashcomp\.bash|g' $(TEST_DEST)/tests/testsuite diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/systemd-create-runtime-dirs.patch b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/systemd-create-runtime-dirs.patch new file mode 100644 index 00000000..65290cf6 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/systemd-create-runtime-dirs.patch @@ -0,0 +1,31 @@ +From 219e7cf9f28fdf14747fdf674bec293f763fe8e3 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Tue, 4 Sep 2018 15:38:59 -0400 +Subject: [PATCH] systemd: create runtime dirs + +The recommendation would be to make use of "RuntimeDirectory=" and +"RuntimeDirectoryMode=" instead of 'mkdir' and 'chown' but since the +upstream service file uses 'chown' we will match this by using +'mkdir'. Without this the service will fail to start since these +directories won't exist. + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + rhel/usr_lib_systemd_system_ovsdb-server.service | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service b/rhel/usr_lib_systemd_system_ovsdb-server.service +index 694598f..0bb2274 100644 +--- a/rhel/usr_lib_systemd_system_ovsdb-server.service ++++ b/rhel/usr_lib_systemd_system_ovsdb-server.service +@@ -10,6 +10,7 @@ Type=forking + Restart=on-failure + EnvironmentFile=/etc/openvswitch/default.conf + EnvironmentFile=-/etc/sysconfig/openvswitch ++ExecStartPre=-/bin/mkdir /var/run/openvswitch /var/log/openvswitch + ExecStartPre=/bin/chown ${OVS_USER_ID} /var/run/openvswitch /var/log/openvswitch + ExecStartPre=/bin/sh -c 'rm -f /run/openvswitch/useropts; if [ "$${OVS_USER_ID/:*/}" != "root" ]; then /bin/echo "OVSUSER=--ovs-user=${OVS_USER_ID}" > /run/openvswitch/useropts; fi' + EnvironmentFile=-/run/openvswitch/useropts +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/systemd-update-tool-paths.patch b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/systemd-update-tool-paths.patch new file mode 100644 index 00000000..d7d4c159 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch-git/systemd-update-tool-paths.patch @@ -0,0 +1,47 @@ +From 163020a5bba1323dc337d72d4771bb81d824b0dc Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Tue, 29 May 2018 18:57:46 +0000 +Subject: [PATCH] systemd: update tool paths + +We are using the rhel files but we install our tools in a slightly +different path, update accordingly. + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + rhel/usr_lib_systemd_system_ovs-vswitchd.service.in | 4 ++-- + rhel/usr_lib_systemd_system_ovsdb-server.service | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in b/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in +index 11b34c6..94c48f8 100644 +--- a/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in ++++ b/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in +@@ -15,8 +15,8 @@ EnvironmentFile=/etc/openvswitch/default.conf + EnvironmentFile=-/etc/sysconfig/openvswitch + EnvironmentFile=-/run/openvswitch/useropts + @begin_dpdk@ +-ExecStartPre=-/bin/sh -c '/usr/bin/chown :$${OVS_USER_ID##*:} /dev/hugepages' +-ExecStartPre=-/usr/bin/chmod 0775 /dev/hugepages ++ExecStartPre=-/bin/sh -c '/bin/chown :$${OVS_USER_ID##*:} /dev/hugepages' ++ExecStartPre=-/bin/chmod 0775 /dev/hugepages + @end_dpdk@ + ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \ + --no-ovsdb-server --no-monitor --system-id=random \ +diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service b/rhel/usr_lib_systemd_system_ovsdb-server.service +index 70da1ec..694598f 100644 +--- a/rhel/usr_lib_systemd_system_ovsdb-server.service ++++ b/rhel/usr_lib_systemd_system_ovsdb-server.service +@@ -10,8 +10,8 @@ Type=forking + Restart=on-failure + EnvironmentFile=/etc/openvswitch/default.conf + EnvironmentFile=-/etc/sysconfig/openvswitch +-ExecStartPre=/usr/bin/chown ${OVS_USER_ID} /var/run/openvswitch /var/log/openvswitch +-ExecStartPre=/bin/sh -c 'rm -f /run/openvswitch/useropts; if [ "$${OVS_USER_ID/:*/}" != "root" ]; then /usr/bin/echo "OVSUSER=--ovs-user=${OVS_USER_ID}" > /run/openvswitch/useropts; fi' ++ExecStartPre=/bin/chown ${OVS_USER_ID} /var/run/openvswitch /var/log/openvswitch ++ExecStartPre=/bin/sh -c 'rm -f /run/openvswitch/useropts; if [ "$${OVS_USER_ID/:*/}" != "root" ]; then /bin/echo "OVSUSER=--ovs-user=${OVS_USER_ID}" > /run/openvswitch/useropts; fi' + EnvironmentFile=-/run/openvswitch/useropts + ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \ + --no-ovs-vswitchd --no-monitor --system-id=random \ +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch.inc b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch.inc new file mode 100644 index 00000000..8aab739b --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch.inc @@ -0,0 +1,162 @@ +SUMMARY = "OpenvSwitch" +DESCRIPTION = "\ + 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) \ + " + +HOMEPAGE = "http://openvswitch.org/" +SECTION = "networking" +LICENSE = "Apache-2" + +DEPENDS += "bridge-utils openssl python3 perl python3-six-native coreutils-native" + +RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \ + python3 perl perl-module-strict ${PN}-switch \ + bash python3-twisted python3-six" +RDEPENDS_${PN}-testcontroller = "${PN} lsb ${PN}-pki" +RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen" +RDEPENDS_${PN}-pki = "${PN}" +RDEPENDS_${PN}-brcompat = "${PN} ${PN}-switch" + +# Some installers will fail because of an install order based on +# rdeps. E.g. ovs-pki calls sed in the postinstall. sed may be +# queued for install later. +RDEPENDS_${PN} += "sed gawk grep" + +SRC_URI = "\ + file://openvswitch-switch \ + file://openvswitch-switch-setup \ + file://openvswitch-testcontroller \ + file://openvswitch-testcontroller-setup \ + " + +EXTRA_OECONF += "\ + PYTHON=python3 \ + PYTHON3=python3 \ + PERL=${bindir}/perl \ + " +CONFIGUREOPT_DEPTRACK = "" + +# Don't compile kernel modules by default since it heavily depends on +# kernel version. Use the in-kernel module for now. +# distro layers can enable with EXTRA_OECONF_pn_openvswitch += "" +# EXTRA_OECONF = "--with-linux=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}" + +ALLOW_EMPTY_${PN}-pki = "1" +PACKAGES =+ "${PN}-testcontroller ${PN}-switch ${PN}-brcompat ${PN}-pki" + +FILES_${PN}-testcontroller = "\ + ${sysconfdir}/init.d/openvswitch-testcontroller \ + ${sysconfdir}/default/openvswitch-testcontroller \ + ${sysconfdir}/openvswitch-testcontroller \ + ${bindir}/ovs-testcontroller \ + " + +FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd" + +FILES_${PN}-switch = "\ + ${sysconfdir}/init.d/openvswitch-switch \ + ${sysconfdir}/default/openvswitch-switch \ + ${systemd_unitdir}/system/ovs-vswitchd.service \ + ${systemd_unitdir}/system/openvswitch.service \ + ${systemd_unitdir}/system/ovsdb-server.service \ + ${sysconfdir}/sysconfig/openvswitch \ + ${sysconfdir}/openvswitch/default.conf \ + " + +# silence a warning +FILES_${PN} += "${datadir}/ovsdbmonitor" +FILES_${PN} += "/run" + +FILES_${PN} += "${libdir}/python${PYTHON_BASEVERSION}/" +inherit autotools update-rc.d systemd python3native + +SYSTEMD_PACKAGES = "${PN}-switch" +SYSTEMD_SERVICE_${PN}-switch = " \ + ovsdb-server.service \ + ovs-vswitchd.service \ + openvswitch.service \ +" + +INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-testcontroller" +INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch" +INITSCRIPT_PARAMS_${PN}-switch = "defaults 71" + +INITSCRIPT_NAME_${PN}-testcontroller = "openvswitch-testcontroller" +INITSCRIPT_PARAMS_${PN}-testcontroller = "defaults 72" + +do_configure_prepend() { + # Work around the for Makefile CC=$(if ....) by swapping out any + # "-Wa," assembly directives with "-Xassembler + CC=`echo '${CC}' | sed 's/-Wa,/-Xassembler /g'` +} + +do_install_prepend() { + SERVICE_FILE="${S}/rhel/usr_lib_systemd_system_ovs-vswitchd.service" + ${S}/build-aux/dpdkstrip.py \ + ${@bb.utils.contains('PACKAGECONFIG','dpdk','--dpdk','--nodpdk',d)} \ + < ${S}/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in \ + > ${SERVICE_FILE} +} + +do_install_append() { + install -d ${D}/${sysconfdir}/default/ + install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch + install -d ${D}/${sysconfdir}/openvswitch-testcontroller + install -m 660 ${WORKDIR}/openvswitch-testcontroller-setup ${D}/${sysconfdir}/default/openvswitch-testcontroller + + install -d ${D}/${sysconfdir}/init.d/ + install -m 755 ${WORKDIR}/openvswitch-testcontroller ${D}/${sysconfdir}/init.d/openvswitch-testcontroller + install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch + true || rm -fr ${D}/${datadir}/${PN}/pki + + install -d ${D}/${sysconfdir}/sysconfig + install -m 644 ${S}/rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \ + ${D}/${sysconfdir}/sysconfig/openvswitch + + install -d ${D}/${sysconfdir}/openvswitch + install -m 644 ${S}/rhel/etc_openvswitch_default.conf \ + ${D}/${sysconfdir}/openvswitch/default.conf + + install -d ${D}/${systemd_unitdir}/system/ + install -m 644 ${S}/rhel/usr_lib_systemd_system_ovs-vswitchd.service \ + ${D}/${systemd_unitdir}/system/ovs-vswitchd.service + install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch.service \ + ${D}/${systemd_unitdir}/system/openvswitch.service + install -m 644 ${S}/rhel/usr_lib_systemd_system_ovsdb-server.service \ + ${D}/${systemd_unitdir}/system/ovsdb-server.service + + oe_runmake modules_install INSTALL_MOD_PATH=${D} + install -d ${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages + cp -r ${S}/python/ovstest/ ${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages/ +} + +pkg_postinst_ontarget_${PN}-pki () { + if test ! -d $D/${datadir}/${PN}/pki; then + ovs-pki init --dir=$D/${datadir}/${PN}/pki + fi +} + +pkg_postinst_ontarget_${PN}-testcontroller () { + if test ! -d $D/${datadir}/${PN}/pki; then + ovs-pki init --dir=$D/${datadir}/${PN}/pki + fi + + cd $D/${sysconfdir}/openvswitch-testcontroller + if ! test -e cacert.pem; then + ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem + fi + if ! test -e privkey.pem || ! test -e cert.pem; then + oldumask=$(umask) + umask 077 + ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null + mv tmp-privkey.pem privkey.pem + mv tmp-cert.pem cert.pem + mv tmp-req.pem req.pem + chmod go+r cert.pem req.pem + umask $oldumask + fi +} diff --git a/external/meta-virtualization/recipes-networking/openvswitch/openvswitch_git.bb b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch_git.bb new file mode 100644 index 00000000..a9309332 --- /dev/null +++ b/external/meta-virtualization/recipes-networking/openvswitch/openvswitch_git.bb @@ -0,0 +1,65 @@ +require openvswitch.inc + +DEPENDS += "virtual/kernel" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +RDEPENDS_${PN}-ptest += "\ + python3-logging python3-syslog python3-io \ + python3-fcntl python3-shell python3-xml python3-math \ + python3-datetime python3-netclient python3 sed \ + ldd perl-module-socket perl-module-carp perl-module-exporter \ + perl-module-xsloader python3-netserver python3-threading \ + python3-resource findutils which \ + " + +S = "${WORKDIR}/git" +PV = "2.10.0+${SRCREV}" + +FILESEXTRAPATHS_append := "${THISDIR}/${PN}-git:" + +SRCREV = "5563e309b80bbea9bff538e71ecfd7e5e538bab9" +SRC_URI = "file://openvswitch-switch \ + file://openvswitch-switch-setup \ + file://openvswitch-testcontroller \ + file://openvswitch-testcontroller-setup \ + git://github.com/openvswitch/ovs.git;protocol=git;branch=branch-2.10 \ + file://openvswitch-add-ptest-${SRCREV}.patch \ + file://run-ptest \ + file://disable_m4_check.patch \ + file://kernel_module.patch \ + file://python-make-remaining-scripts-use-usr-bin-env.patch \ + file://0002-Define-WAIT_ANY-if-not-provided-by-system.patch \ + file://python-switch-remaining-scripts-to-use-python3.patch \ + file://systemd-update-tool-paths.patch \ + file://systemd-create-runtime-dirs.patch \ + " + +LIC_FILES_CHKSUM = "file://LICENSE;md5=1ce5d23a6429dff345518758f13aaeab" + +DPDK_INSTALL_DIR ?= "/opt/dpdk" + +PACKAGECONFIG ?= "libcap-ng" +PACKAGECONFIG[dpdk] = "--with-dpdk=${STAGING_DIR_TARGET}${DPDK_INSTALL_DIR}/share/${TARGET_ARCH}-native-linuxapp-gcc,,dpdk,dpdk" +PACKAGECONFIG[libcap-ng] = "--enable-libcapng,--disable-libcapng,libcap-ng," +PACKAGECONFIG[ssl] = ",--disable-ssl,openssl," + +# Don't compile kernel modules by default since it heavily depends on +# kernel version. Use the in-kernel module for now. +# distro layers can enable with EXTRA_OECONF_pn_openvswitch += "" +# EXTRA_OECONF += "--with-linux=${STAGING_KERNEL_BUILDDIR} --with-linux-source=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}" + +# silence a warning +FILES_${PN} += "/lib/modules" + +inherit ptest + +EXTRA_OEMAKE += "TEST_DEST=${D}${PTEST_PATH} TEST_ROOT=${PTEST_PATH}" + +do_install_ptest() { + oe_runmake test-install +} + +do_install_append() { + oe_runmake modules_install INSTALL_MOD_PATH=${D} +} |