fuel plugin: Initial version 75/5675/1
authorBilly O'Mahony <billy.o.mahony@intel.com>
Wed, 6 Jan 2016 17:00:41 +0000 (17:00 +0000)
committerBilly O'Mahony <billy.o.mahony@intel.com>
Wed, 6 Jan 2016 17:14:07 +0000 (17:14 +0000)
Change-Id: Ib41afff8f0b0f5e7c2f92f78cbdc48c99891b1ab
Signed-off-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Billy O'Mahony <billy.o.mahony@intel.com>
Signed-off-by: Michal Ptacek <michalx.ptacek@intel.com>
27 files changed:
fuel-plugin-ovsnfv/.gitignore [new file with mode: 0644]
fuel-plugin-ovsnfv/LICENSE [new file with mode: 0644]
fuel-plugin-ovsnfv/README.md [new file with mode: 0644]
fuel-plugin-ovsnfv/deployment_scripts/puppet/manifests/ovs-install-ovsnfv-compute.pp [new file with mode: 0644]
fuel-plugin-ovsnfv/deployment_scripts/puppet/manifests/ovs-install-ovsnfv-controller.pp [new file with mode: 0644]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/build_ovs_dpdk.erb [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/kvm-wrapper.sh [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/ovs-dpdk-conf.erb [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/tune_params.sh [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/build_ovs_dpdk.pp [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/clone.pp [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/init.pp [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/params.pp [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/uninstall_ovs.pp [new file with mode: 0755]
fuel-plugin-ovsnfv/deployment_tasks.yaml [new file with mode: 0644]
fuel-plugin-ovsnfv/environment_config.yaml [new file with mode: 0644]
fuel-plugin-ovsnfv/metadata.yaml [new file with mode: 0644]
fuel-plugin-ovsnfv/ovs_package/ubuntu/dependencies.txt [new file with mode: 0644]
fuel-plugin-ovsnfv/pre_build_hook [new file with mode: 0755]
fuel-plugin-ovsnfv/tasks.yaml [new file with mode: 0644]

diff --git a/fuel-plugin-ovsnfv/.gitignore b/fuel-plugin-ovsnfv/.gitignore
new file mode 100644 (file)
index 0000000..bbf313b
--- /dev/null
@@ -0,0 +1,32 @@
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
diff --git a/fuel-plugin-ovsnfv/LICENSE b/fuel-plugin-ovsnfv/LICENSE
new file mode 100644 (file)
index 0000000..0f0e8e8
--- /dev/null
@@ -0,0 +1,202 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2010-2015 Intel Corporation. All rights reserved.
+
+   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.
+
diff --git a/fuel-plugin-ovsnfv/README.md b/fuel-plugin-ovsnfv/README.md
new file mode 100644 (file)
index 0000000..14398b2
--- /dev/null
@@ -0,0 +1,5 @@
+Userspace Openvswitch Plugin for Fuel
+=====================================
+
+* mark.d.gray@intel.com
+
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/manifests/ovs-install-ovsnfv-compute.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/manifests/ovs-install-ovsnfv-compute.pp
new file mode 100644 (file)
index 0000000..f95cbb8
--- /dev/null
@@ -0,0 +1,12 @@
+$fuel_settings = parseyaml(file('/etc/astute.yaml'))
+$master_ip = $::fuel_settings['master_ip']
+
+if $operatingsystem == 'Ubuntu' {
+  class { '::ovsdpdk':
+    ovs_bridge_mappings => 'default:br-eth3',
+    ovs_socket_mem      => '512',
+    ovs_num_hugepages   => '256',
+    compute             => 'True',
+  }
+} elsif $operatingsystem == 'CentOS' {
+}
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/manifests/ovs-install-ovsnfv-controller.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/manifests/ovs-install-ovsnfv-controller.pp
new file mode 100644 (file)
index 0000000..df20a85
--- /dev/null
@@ -0,0 +1,12 @@
+$fuel_settings = parseyaml(file('/etc/astute.yaml'))
+$master_ip = $::fuel_settings['master_ip']
+
+if $operatingsystem == 'Ubuntu' {
+  class { '::ovsdpdk':
+    ovs_bridge_mappings => '',
+    ovs_socket_mem      => '512',
+    ovs_num_hugepages   => '256',
+    controller          => 'True',
+  }
+} elsif $operatingsystem == 'CentOS' {
+}
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/build_ovs_dpdk.erb b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/build_ovs_dpdk.erb
new file mode 100755 (executable)
index 0000000..215d0b1
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+set -o xtrace
+
+if [  -e <%= @ovs_dir %>/BUILD_COMPLETE ]; then
+   echo "Build already done."
+   cd <%= @ovs_dir %>
+   sudo make install
+else
+   cd <%= @ovs_dpdk_dir %>
+   make config T=<%= @rte_target %>
+
+   if [ -e <%= @ovs_dpdk_dir %>/<%= @rte_target %> ]; then
+      rm <%= @rte_target %>
+   fi
+
+   # block of code with more strict error handling
+   set -o errexit
+   ln -s -f build <%= @rte_target %>
+   sed "s/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/" -i <%= @ovs_dpdk_dir %>/build/.config
+   sed "s/CONFIG_RTE_MAX_MEMSEG=.*$/CONFIG_RTE_MAX_MEMSEG=<%= @ovs_dpdk_mem_segments %>/" -i <%= @ovs_dpdk_dir %>/build/.config
+   sed "s/CONFIG_RTE_LIBRTE_VHOST=.*$/CONFIG_RTE_LIBRTE_VHOST=<%= @ovs_dpdk_rte_librte_vhost %>/" -i <%= @ovs_dpdk_dir %>/build/.config
+   sed "s/CONFIG_RTE_LIBRTE_VHOST_DEBUG=.*$/CONFIG_RTE_LIBRTE_VHOST_DEBUG=<%= @ovs_dpdk_vhost_user_debug %>/" -i <%= @ovs_dpdk_dir %>/build/.config
+   make -j `nproc`
+   sudo cp <%= @ovs_dpdk_dir %>/build/lib/*dpdk.* /lib
+   cd <%= @ovs_dir %>
+   ./boot.sh
+   ./configure --with-dpdk=<%= @ovs_dpdk_dir %>/<%= @rte_target %> --prefix=/usr --with-dbdir=<%= @ovs_db_conf_dir %> --with-rundir=<%= @ovs_db_socket_dir %>
+   make -j `nproc` CFLAGS='-O3 -march=native'
+   touch <%= @ovs_dir %>/BUILD_COMPLETE
+   sudo make install
+   set +o errexit
+fi
+
+
+set +o xtrace
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh
new file mode 100755 (executable)
index 0000000..9110b45
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+# Short script for uninstallation of OVS with DPDK
+
+# enable debugging:
+#set -o xtrace
+
+# Stopping service if needed
+echo "[debug] stopping ovs-dpdk (if needed)"
+sudo service ovs-dpdk status 2>&1 1>/dev/null
+res=$?
+
+if [ $res -eq 2 ]; then
+    echo "[warning] service ovs-dpdk is already stopped"
+else
+    echo "[debug] stopping ovs-dpdk service"
+    sudo service ovs-dpdk stop 2>&1 1>/dev/null
+fi
+
+# Remove  ovs-dpdk service
+echo "[debug] removing ovs-dpdk service"
+sudo rm -f /etc/default/ovs-dpdk
+sudo rm -f /etc/init.d/ovs-dpdk
+
+# kvm wrapper
+echo "[debug] replacing kvm wrapper"
+if [ -e /usr/bin/kvm ]; then
+    KVM_CMD="/usr/bin/kvm"
+elif [ -e /usr/bin/qemu-kvm ]; then
+    KVM_CMD="/usr/bin/qemu-kvm"
+elif [ -e /usr/libexec/qemu-kvm ]; then
+    KVM_CMD="/usr/libexec/qemu-kvm"
+else
+    echo "[warning] package qemu-kvm probably not installed"
+fi
+
+cat << 'EOF' | sudo tee  $KVM_CMD
+#!/bin/sh
+
+exec /usr/bin/qemu-system-x86_64  "${args[@]}"
+EOF
+
+
+# remove git repos
+echo "[warning] git repos were not automatically removed, you can remove it once you're finished with them"
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh
new file mode 100755 (executable)
index 0000000..c77258f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+for bridge in `sudo ovs-vsctl list-br`; do sudo ovs-vsctl --no-wait set Bridge $bridge datapath_type=netdev; done;
+
+# Configure integration bridge with specified datapath
+#sudo ovs-vsctl --no-wait -- --may-exist add-br br-int
+#if [ "$1" != "" ]; then
+    #sudo ovs-vsctl --no-wait set Bridge br-int datapath_type=$1
+#fi
+#sudo ovs-vsctl --no-wait br-set-external-id br-int bridge-id br-int
+
+# Configure external bridge with specified datapath
+#sudo ovs-vsctl --no-wait -- --may-exist add-br br-ex
+#if [ "$1" != "" ]; then
+    #sudo ovs-vsctl --no-wait set Bridge br-ex datapath_type=$1
+#fi
+#sudo ovs-vsctl --no-wait br-set-external-id br-ex bridge-id br-ex
+
+# Configure br-tun bridge with specified datapath
+#sudo ovs-vsctl --no-wait -- --may-exist add-br br-tun
+#if [ "$1" != "" ]; then
+    #sudo ovs-vsctl --no-wait set Bridge br-tun datapath_type=$1
+#fi
+#sudo ovs-vsctl --no-wait br-set-external-id br-tun bridge-id br-tun
+
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/kvm-wrapper.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/kvm-wrapper.sh
new file mode 100755 (executable)
index 0000000..ea98408
--- /dev/null
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+VIRTIO_OPTIONS="csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off"
+VHOST_FORCE="vhostforce"
+SHARE="share=on"
+add_mem=False
+i=0
+while [ $# -gt 0 ]; do
+     case "$1" in
+
+     -device)
+        args[i]="$1"
+        (( i++ ))
+        shift
+        if [[ $1 =~ "vhost-user" ]]
+        then
+                args[i]=${1},${VHOST_FORCE}
+                (( i++))
+                shift
+
+        fi
+        ;;
+    -object)
+        args[i]="$1"
+        (( i++ ))
+        shift
+        if [[ $1 =~ "memory-backend-file" ]]
+        then
+                args[i]=${1},${SHARE}
+                (( i++))
+                shift
+
+        fi
+        ;;
+
+     *)
+         args[i]="$1"
+         (( i++ ))
+         shift ;;
+     esac
+done
+echo "qemu ${args[@]}"  > /tmp/qemu.orig
+if [ -e /usr/bin/qemu-system-x86_64 ]; then
+    exec /usr/bin/qemu-system-x86_64  "${args[@]}"
+elif [ -e /usr/libexec/qemu-kvm.orig ]; then
+    exec /usr/libexec/qemu-kvm.orig  "${args[@]}"
+fi
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf
new file mode 100755 (executable)
index 0000000..185ae8e
--- /dev/null
@@ -0,0 +1,13 @@
+# vim: set ft=upstart ts=2 et:
+description "Open vSwitch switch DPDK"
+
+start on (local-filesystems and net-device-up IFACE=lo)
+stop on runlevel [!2345]
+
+pre-start script
+  /etc/init.d/ovs-dpdk start
+end script
+
+post-stop script
+  /etc/init.d/ovs-dpdk stop
+end script
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service
new file mode 100755 (executable)
index 0000000..f46f9c7
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Open vSwitch with DPDK
+
+[Service]
+Type=oneshot
+ExecStart=/etc/init.d/ovs-dpdk start
+ExecStop=/etc/init.d/ovs-dpdk stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/ovs-dpdk-conf.erb b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/ovs-dpdk-conf.erb
new file mode 100755 (executable)
index 0000000..4fd8604
--- /dev/null
@@ -0,0 +1,28 @@
+RTE_SDK=<%= @ovs_dpdk_dir %>
+RTE_TARGET=<%= @rte_target %>
+
+OVS_INSTALL_DIR=<%= @ovs_install_dir %>
+OVS_DB_CONF_DIR=<%= @ovs_db_conf_dir %>
+OVS_DB_SOCKET_DIR=<%= @ovs_db_socket_dir %>
+OVS_DB_CONF=<%= @ovs_db_conf_dir %>/conf.db
+OVS_DB_SOCKET=<%= @ovs_db_socket_dir %>/db.sock
+
+OVS_SOCKET_MEM=<%= @ovs_socket_mem %>
+OVS_MEM_CHANNELS=<%= @ovs_mem_channels %>
+OVS_CORE_MASK=<%= @ovs_core_mask %>
+OVS_PMD_CORE_MASK=<%= @ovs_pmd_core_mask %>
+OVS_LOG_DIR=<%= @ovs_log_dir %>
+OVS_LOCK_DIR=<%= @ovs_lock_dir %>
+OVS_DIR=<%= @ovs_dir %>
+OVS_UTILS=<%= @ovs_dir %>/utilities/
+OVS_DB_UTILS=<%= @ovs_dir %>/ovsdb/
+OVS_DPDK_DIR=<%= @ovs_dpdk_dir %>
+OVS_NUM_HUGEPAGES=<%= @ovs_num_hugepages %>
+OVS_HUGEPAGE_MOUNT=<%= @ovs_hugepage_mount %>
+OVS_HUGEPAGE_MOUNT_PAGESIZE=<%= @ovs_hugepage_mount_pagesize %>
+OVS_BRIDGE_MAPPINGS=<%= @ovs_bridge_mappings %>
+OVS_PCI_MAPPINGS=<%= @ovs_pci_mappings %>
+OVS_DPDK_PORT_MAPPINGS=<%= @ovs_dpdk_port_mappings %>
+OVS_TUNNEL_CIDR_MAPPING=<%= @ovs_tunnel_cidr_mapping %>
+OVS_ALLOCATE_HUGEPAGES=<%= @ovs_allocate_hugepages %>
+OVS_INTERFACE_DRIVER=<%= @ovs_interface_driver %>
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh
new file mode 100755 (executable)
index 0000000..0cb3791
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/env  bash
+
+# Small script for calculation of cores not suitable for deployment
+# of VM's and adaptation of nova.conf accordingly
+# nova.conf path should come as first param
+# this should be executed when nova is enabled and already configured
+
+source /etc/default/ovs-dpdk
+
+OVS_CORE_MASK=$(echo $OVS_CORE_MASK | sed 's/^0x//')
+OVS_PMD_CORE_MASK=$(echo $OVS_PMD_CORE_MASK | sed 's/^0x//')
+BAD_CORES=$((`echo $((16#${OVS_CORE_MASK}))` | `echo $((16#${OVS_PMD_CORE_MASK}))`))
+TOTAL_CORES=`nproc`
+vcpu_pin_set=""
+
+for cpu in $(seq 0 `expr $TOTAL_CORES - 1`);do
+    tmp=`echo 2^$cpu | bc`
+    if [ $(($tmp & $BAD_CORES)) -eq 0 ]; then
+        vcpu_pin_set+=$cpu","
+    fi
+done
+vcpu_pin_set=${vcpu_pin_set::-1}
+
+crudini --set $1 DEFAULT vcpu_pin_set $vcpu_pin_set
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/tune_params.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/tune_params.sh
new file mode 100755 (executable)
index 0000000..e9908e4
--- /dev/null
@@ -0,0 +1,86 @@
+#!/usr/bin/env  bash
+
+# It adapts /etc/default/ovs-dpdk file
+# generated mainly from devstack/libs/ovs-dpdk
+# it will modify / tune variables, which are not configured directly
+
+source /etc/default/ovs-dpdk
+
+if [ $OVS_SOCKET_MEM == "auto" ] ; then
+    for d in /sys/devices/system/node/node? ; do
+        if [ $OVS_SOCKET_MEM == "auto" ]; then
+                OVS_SOCKET_MEM=2048
+        else
+                OVS_SOCKET_MEM=$OVS_SOCKET_MEM,2048
+        fi
+    done
+fi
+
+sudo sed "s#OVS_SOCKET_MEM=.*#OVS_SOCKET_MEM=$OVS_SOCKET_MEM#" -i /etc/default/ovs-dpdk
+
+# Creates an array of pci addres to interface names delimeted by # e.g. <pci_address>#<interface name>
+PAIRS=( `ls -al /sys/class/net/* | grep pci | rev | awk '{print $1;}' | cut -d '/' -f 1,3 | rev |  sed s'/\//#/'` )
+# Populates OVS_BRIDGE_MAPPINGS if $PHYSICAL_NETWORK and $OVS_PHYSICAL_BRIDGE are used instead.
+if [[ "$OVS_DATAPATH_TYPE" != "" ]] && [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then
+    OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE
+fi
+
+if [[ -z "$OVS_DPDK_PORT_MAPPINGS" ]]; then
+    OVS_BRIDGES=${OVS_BRIDGE_MAPPINGS//,/ }
+    ARRAY=( $OVS_BRIDGES )
+    for net in "${ARRAY[@]}"; do
+        bridge="${net##*:}"
+        nic=${bridge/br-/}
+        if [[ -z "$OVS_DPDK_PORT_MAPPINGS" ]]; then
+            OVS_DPDK_PORT_MAPPINGS=$nic:$bridge
+        else
+            OVS_DPDK_PORT_MAPPINGS=$OVS_DPDK_PORT_MAPPINGS,$nic:$bridge
+        fi
+    done
+fi
+
+MAPPINGS=${OVS_DPDK_PORT_MAPPINGS//,/ }
+
+ARRAY=( $MAPPINGS )
+NICS=""
+for net in "${ARRAY[@]}"; do
+    nic="${net%%:*}"
+    bridge="${net##*:}"
+    printf "%s in %s\n" "$KEY" "$VALUE"
+    for pair in "${PAIRS[@]}"; do
+        if [[ $nic == `echo $pair | cut -f 2 -d "#"` ]]; then
+            if [[ $NICS == "" ]]; then
+                NICS=$pair
+            else
+                NICS=$NICS,$pair
+            fi
+        fi
+    done
+done
+sudo sed "s/OVS_PCI_MAPPINGS=.*/OVS_PCI_MAPPINGS=$NICS/" -i /etc/default/ovs-dpdk
+sudo sed "s/OVS_BRIDGE_MAPPINGS=.*/OVS_BRIDGE_MAPPINGS=$OVS_BRIDGE_MAPPINGS/" -i /etc/default/ovs-dpdk
+sudo sed "s/OVS_DPDK_PORT_MAPPINGS=.*/OVS_DPDK_PORT_MAPPINGS=$OVS_DPDK_PORT_MAPPINGS/" -i /etc/default/ovs-dpdk
+
+OVS_PMD_CORE_MASK=$(echo $OVS_PMD_CORE_MASK | sed 's/^0x//')
+
+if [ $OVS_PMD_CORE_MASK -eq 4 ]; then
+    #default value, check for siblings in case of hyperthreading enabled
+    SIBLINGS=""
+    RESULT=0
+    FILE="/sys/devices/system/cpu/cpu3/topology/thread_siblings_list"
+    if [ -e $FILE ]; then
+        SIBLINGS=`cat $FILE`
+    else
+        echo "warning: don't know how to check siblings"
+        SIBLINGS=3
+    fi
+
+    for SIBLING in $(echo $SIBLINGS | sed -n 1'p' | tr ',' '\n'); do
+        SIBLING_CORE=`echo "obase=10;$((1<<($SIBLING-1)))" | bc`
+        RESULT=$(($RESULT | $SIBLING_CORE))
+    done
+
+    OVS_PMD_CORE_MASK=`printf "%x" $RESULT`
+fi
+
+sudo sed "s#OVS_PMD_CORE_MASK=.*#OVS_PMD_CORE_MASK=$OVS_PMD_CORE_MASK#" -i /etc/default/ovs-dpdk
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/build_ovs_dpdk.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/build_ovs_dpdk.pp
new file mode 100755 (executable)
index 0000000..ad0b712
--- /dev/null
@@ -0,0 +1,20 @@
+# == Class: ovsdpdk::build_ovs_dpdk
+#
+# It executes build of OVS with DPDK support from configured shell script
+#
+class ovsdpdk::build_ovs_dpdk (
+  $plugin_dir =  $::ovsdpdk::params::plugin_dir,
+) inherits ovsdpdk {
+  require ovsdpdk::uninstall_ovs
+
+  file {"${plugin_dir}/files/build_ovs_dpdk.sh":
+      content => template("${plugin_dir}/files/build_ovs_dpdk.erb"),
+      mode    => '0775',
+  }
+
+  exec {"${plugin_dir}/files/build_ovs_dpdk.sh":
+      require => File["${plugin_dir}/files/build_ovs_dpdk.sh"],
+      timeout => 0,
+  }
+}
+
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/clone.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/clone.pp
new file mode 100755 (executable)
index 0000000..255de0e
--- /dev/null
@@ -0,0 +1,49 @@
+# == Class: ovsdpdk::clone
+#
+# Responsible for downloading all relevant git repos for setting up of OVS+DPDK
+#
+class ovsdpdk::clone(
+  $dest                    = $::ovsdpdk::params::dest,
+  $ovs_dir                 = $::ovsdpdk::params::ovs_dir,
+  $ovs_dpdk_dir            = $::ovsdpdk::params::ovs_dpdk_dir,
+  $networking_ovs_dpdk_dir = $::ovsdpdk::params::networking_ovs_dpdk_dir,
+  $ovs_git_tag             = $::ovsdpdk::params::ovs_git_tag,
+  $ovs_dpdk_git_tag        = $::ovsdpdk::params::ovs_dpdk_git_tag,
+  $ovs_plugin_git_tag      = $::ovsdpdk::params::ovs_plugin_git_tag,
+  $master_ip               = $::ovsdpdk::params::master_ip,
+) inherits ovsdpdk {
+
+  file { $dest:
+    ensure => directory,
+    mode   => '0755',
+  }
+
+  package { 'git':
+    ensure   => installed,
+  }
+
+  package { 'python-pip':
+    ensure   => installed,
+  }
+
+  exec { "wget dpdk":
+    command => "rm -rf dpdk.tgz $ovs_dpdk_dir && wget http://$master_ip:8080/plugins/fuel-plugin-ovsnfv-0.0/repositories/ubuntu/dpdk.tgz && tar xf dpdk.tgz && mv dpdk $ovs_dpdk_dir",
+    path    => "/usr/bin:/usr/sbin:/bin:/sbin",
+  }
+
+  exec { "wget ovs":
+    command => "rm -rf ovs.tgz $ovs_dir && wget http://$master_ip:8080/plugins/fuel-plugin-ovsnfv-0.0/repositories/ubuntu/ovs.tgz && tar xf ovs.tgz && mv ovs $ovs_dir",
+    path    => "/usr/bin:/usr/sbin:/bin:/sbin",
+  }
+
+  exec { "wget networking_ovs_dpdk":
+    command => "rm -rf networking-ovs-dpdk.tgz $networking_ovs_dpdk_dir && wget http://$master_ip:8080/plugins/fuel-plugin-ovsnfv-0.0/repositories/ubuntu/networking-ovs-dpdk.tgz && tar xf networking-ovs-dpdk.tgz && mv networking-ovs-dpdk $networking_ovs_dpdk_dir",
+    path    => "/usr/bin:/usr/sbin:/bin:/sbin",
+  }
+
+  exec { "install pbr":
+    command => "wget http://$master_ip:8080/plugins/fuel-plugin-ovsnfv-0.0/repositories/ubuntu/pbr-1.8.1-py2.py3-none-any.whl && pip install pbr-1.8.1-py2.py3-none-any.whl",
+    path    => "/usr/bin:/usr/sbin:/bin:/sbin",
+    require => Package['python-pip'],
+  }
+}
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/init.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/init.pp
new file mode 100755 (executable)
index 0000000..de5b362
--- /dev/null
@@ -0,0 +1,131 @@
+# == Class: ovsdpdk
+#
+# Configures and installs OVS with DPDK support service
+#
+# == Parameters:
+#
+# [*rte_target*]
+#   rte_target to compile OVS DPDK
+#   Defaults to 'x86_64-native-linuxapp-gcc'
+#
+# [*ovs_dpdk_mem_segments*]
+#   another parameter for OVS DPDK build
+#   Defaults to '256'
+#
+# [*ovs_dpdk_rte_librte_vhost*]
+#   another parameter for OVS DPDK build
+#   Defaults to 'y'
+#
+# [*ovs_dpdk_vhost_user_debug*]
+#   (True/False) indicates whether to enable debugging for VHOST USER in DPDK
+#   Defaults to 'n'
+#
+# [*ovs_allocate_hugepages*]
+#   (True/False) indicates whether to allocate hugepages during ovs-dpdk startup
+#   Defaults to 'True'
+#
+# [*ovs_datapath_type*]
+#   OVS bridges will be set to use this datapath, possible values are 'system'
+#   for kernel OVS and 'netdev' for userspace OVS
+#   Defaults to 'netdev'
+#
+# [*ovs_tunnel_cidr_mapping*]
+#   (bridge:cidr) when specified, this option enables automatic assignment of
+#   the tunnel endpoint ip to a specific interface.
+#   e.g. OVS_TUNNEL_CIDR_MAPPING=br-phy:192.168.50.1/24 assignes the ip of
+#   192.168.50.1 with subnetmask 255.255.255.0 to the br-phy local port.
+#   This is required to enabled vxlan or other tunneling protocols with ovs-dpdk
+#   and dpdk physical ports.
+#
+# [*ovs_hugepage_mount*]
+#   mount point to use for hugepages. It's created and hugepages mounted if
+#   it doesn't exist on the filesystem
+#   Defaults to '/mnt/huge'
+#
+# [*ovs_hugepage_mount_pagesize*]
+#   preffered hugepage size (2M/1G)
+#   Defaults to OS defaults if not set. If '1G' value is used hugepages should be
+#   allocated before starting ovs (e.g. kernel boot command line)
+#
+# [*ovs_num_hugepages*]
+#   amount of hugepages to mount if ovs_allocate_hugepages is True
+#
+# [*ovs_socket_mem*]
+#   amount of memory to allocate on socket, recommended minimum is '512' MB
+#
+# [*ovs_mem_channels*]
+#   number of memory channels into the processor OVS will use
+#
+# [*ovs_core_mask*]
+#   cpu core mask in hexa format, is used for ovs-vswitchd process as -c option
+#   Defaults is '2'
+#   Example:
+#   ovs_core_mask=3 (0x11 binary -> first two cores taken)
+#
+# [*ovs_pmd_core_mask*]
+#   mask in hexa format for PMD threads od OVS set in the db.
+#   ovs_pmd_core_mask value is used for other_config:pmd-cpu-mask parameter in
+#   ovsdb.
+#   Defaults is '4'. In case of HT enabled, it's 4 + sibling
+#
+# [*ovs_bridge_mappings*]
+#   (network:bridge) list of comma separated pairs of "physical network:bridge"
+#   used by OVS/DPDK.
+#   Example: ovs_bridge_mappings=default:br-eth1,defaul1:br-enp9s0f0
+#
+# [*ovs_dpdk_port_mappings*]
+#   (nic:bridge) list of comma separated pairs of "nic:bridge name" used by
+#   OVS/DPDK. "nic" must be a NIC interface present in the system
+#   "bridge" is the linux bridge created by OVS
+#   Example: ovs_dpdk_port_mappings=eth1:br-01,eth2:br02
+#
+# [*ovs_log_dir*]
+#   directory where ovs-vswitchd.log will be created
+#   Defaults: "/tmp"
+#
+# [*ovs_lock_dir*]
+#   directory containing OVS lock file
+#
+# [*ovs_interface_driver*]
+#   (vfio-pci/igb_uio) NIC driver to use for physical network interfaces.
+#   Drivers names are the ones supported by DPDK, i.e: not the kernel names.
+#   Defaults: "igb_uio"
+#
+# [*ovs_patches*]
+#   *todo*
+#
+# [*ovs_dpdk_patches*]
+#   *todo*
+#
+class ovsdpdk (
+  $rte_target                  = 'x86_64-native-linuxapp-gcc',
+  $ovs_dpdk_mem_segments       = '256',
+  $ovs_dpdk_rte_librte_vhost   = 'y',
+  $ovs_dpdk_vhost_user_debug   = 'n',
+  $ovs_allocate_hugepages      = 'True',
+  $ovs_datapath_type           = 'netdev',
+  $ovs_tunnel_cidr_mapping     = '',
+  $ovs_hugepage_mount          = '/mnt/huge',
+  $ovs_hugepage_mount_pagesize = '2M',
+  $ovs_num_hugepages           = '1024',
+  $ovs_socket_mem              = 'auto',
+  $ovs_mem_channels            = '4',
+  $ovs_core_mask               = '2',
+  $ovs_pmd_core_mask           = '4',
+  $ovs_bridge_mappings         = '',
+  $ovs_dpdk_port_mappings      = '',
+  $ovs_log_dir                 = '/tmp',
+  $ovs_lock_dir                = '',
+  $ovs_interface_driver        = 'igb_uio',
+  $ovs_patches                 = '',
+  $ovs_dpdk_patches            = '',
+  $controller                  = 'False',
+  $compute                     = 'False',
+) inherits ::ovsdpdk::params {
+
+  include '::ovsdpdk::clone'
+  include '::ovsdpdk::uninstall_ovs'
+  include '::ovsdpdk::build_ovs_dpdk'
+  include '::ovsdpdk::install_ovs_dpdk'
+  include '::ovsdpdk::postinstall_ovs_dpdk'
+}
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp
new file mode 100755 (executable)
index 0000000..2b446de
--- /dev/null
@@ -0,0 +1,76 @@
+# == Class ovsdpdk::install_ovs_dpdk
+#
+# Installs ovs-dpdk service together with it's configuration file
+# it also deploys qemu-kvm wrapper responsible for enabling some vhostforce
+# options and setting huge pages into shared mode
+#
+class ovsdpdk::install_ovs_dpdk (
+  $networking_ovs_dpdk_dir          = $::ovsdpdk::params::networking_ovs_dpdk_dir,
+  $plugin_dir                       = $::ovsdpdk::params::plugin_dir,
+  $openvswitch_service_file         = $::ovsdpdk::params::openvswitch_service_file,
+  $openvswitch_service_path         = $::ovsdpdk::params::openvswitch_service_path,
+  $qemu_kvm                         = $::ovsdpdk::params::qemu_kvm,
+) inherits ovsdpdk {
+  require ovsdpdk::build_ovs_dpdk
+
+  if $compute == 'True' {
+         exec {'create_ovs_dpdk':
+           command => "mv /etc/init.d/openvswitch-switch /tmp/openvswitch-switch.bak;cp ${networking_ovs_dpdk_dir}/devstack/ovs-dpdk/ovs-dpdk-init /etc/init.d/openvswitch-switch;chmod +x /etc/init.d/openvswitch-switch; ln -sf /etc/init.d/openvswitch-switch /etc/init.d/ovs-dpdk; cp /etc/openvswitch/conf.db /etc/openvswitch/conf.db.pre_dpdk",
+           user    => root,
+           path    => ['/usr/bin','/bin'],
+         }
+
+         file {'/etc/default/ovs-dpdk': content => template("${plugin_dir}/files/ovs-dpdk-conf.erb"), mode => '0644' }
+
+         exec {'adapt_conf_file':
+           command => "${plugin_dir}/files/tune_params.sh",
+           user    => root,
+           require => File['/etc/default/ovs-dpdk'],
+         }
+
+#        exec { 'update ovs service':
+#          command => "cp ${plugin_dir}/files/${openvswitch_service_file} ${openvswitch_service_path}/${openvswitch_service_file}",
+#          path    => ['/usr/bin','/bin'],
+#          user    => root,
+#          onlyif  => "test -f ${openvswitch_service_path}/${openvswitch_service_file}",
+#        }
+
+         if $::operatingsystem == 'CentOS' {
+           exec { 'systemctl daemon-reload':
+             path    => ['/usr/bin','/bin','/usr/sbin'],
+             user    => root,
+             require => Exec['update ovs service'],
+           }
+         }
+
+         package {'qemu-kvm': ensure => installed }
+
+         exec { "cp ${qemu_kvm} ${qemu_kvm}.orig":
+           path    => ['/usr/bin','/bin'],
+           user    => root,
+           onlyif  => "test -f ${qemu_kvm}",
+           require => Package['qemu-kvm'],
+         }
+
+         exec { "cp ${plugin_dir}/files/kvm-wrapper.sh ${qemu_kvm};chmod +x ${qemu_kvm}":
+           path    => ['/usr/bin','/bin'],
+           user    => root,
+           onlyif  => "test -f ${qemu_kvm}",
+           require => [ Exec["cp ${qemu_kvm} ${qemu_kvm}.orig"], Package['qemu-kvm'] ],
+         }
+
+#exec {'init ovs-dpdk':
+#command => '/etc/init.d/ovs-dpdk init',
+#user    => root,
+#require => [ Exec['create_ovs_dpdk'], File['/etc/default/ovs-dpdk'] ],
+#}
+  }
+
+  # install mech driver
+  exec {'install mech driver':
+    command => 'python setup.py install',
+    path    => ['/usr/bin','/bin'],
+    cwd     => "${networking_ovs_dpdk_dir}",
+    user    => root,
+  }
+}
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/params.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/params.pp
new file mode 100755 (executable)
index 0000000..3d7bdfa
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# This class contains the platform differences for ovsdpdk
+# and environment not commonly configured stuff
+#
+class ovsdpdk::params {
+
+  case $::operatingsystem {
+    'Ubuntu': {
+      $qemu_kvm = '/usr/bin/kvm'
+      # we are not removing packages as of now
+      #$remove_packages = [ 'openvswitch-switch', 'openvswitch-datapath-dkms', 'openvswitch-common' ]
+      $install_packages = [ 'autoconf', 'libtool', 'screen' ]
+      $openvswitch_service_name = 'openvswitch-switch'
+      $openvswitch_service_file = 'openvswitch-switch.conf'
+      $openvswitch_service_path = '/etc/init'
+      $openvswitch_agent = 'neutron-plugin-openvswitch-agent'
+    }
+    'CentOS': {
+      $qemu_kvm = '/usr/libexec/qemu-kvm'
+      # we are not removing packages as of now
+      $remove_packages = [ 'openvswitch' ]
+      $install_packages = [ 'pciutils', 'autoconf', 'libtool', 'screen' ]
+      $openvswitch_service_name = 'openvswitch'
+      $openvswitch_service_file = 'openvswitch.service'
+      $openvswitch_service_path = '/usr/lib/systemd/system'
+      $openvswitch_agent = 'neutron-openvswitch-agent'
+    }
+    default: {
+      fail("Unsupported os ${::operatingsystem}")
+    }
+  }
+
+  $ovs_db_conf_dir          = '/etc/openvswitch'
+  $ovs_db_socket_dir        = '/var/run/openvswitch'
+  $ovs_db_socket            = "${ovs_db_socket_dir}/db.sock"
+  $ovs_db_conf              = "${ovs_db_conf_dir}/conf.db"
+
+  # General config
+  $plugin_dir               = '/etc/fuel/plugins/fuel-plugin-ovsnfv-0.0/puppet/modules/ovsdpdk'
+  $dest                     = '/opt/code'
+  $nova_conf_dir            = '/etc/nova'
+  $nova_conf                = "${nova_conf_dir}/nova.conf"
+  $ml2_ovs_conf             = '/etc/neutron/plugins/ml2/openvswitch_agent.ini'
+  $neutron_l3_conf          = '/etc/neutron/l3_agent.ini'
+
+  # OVS config
+  $ovs_install_dir          = '/usr'
+  $ovs_git_repo             = 'https://github.com/openvswitch/ovs.git'
+  $ovs_dir                  = "${dest}/ovs"
+  $ovs_git_tag              = '88058f19ed9aadb1b22d26d93e46b3fd5eb1ad32'
+
+  # DPDK config
+  $ovs_dpdk_git_repo        = 'http://dpdk.org/git/dpdk'
+  $ovs_dpdk_git_tag         = 'v2.1.0'
+  $ovs_dpdk_dir             = "${dest}/DPDK-${ovs_dpdk_git_tag}"
+
+  # PLUGIN config
+  $networking_ovs_dpdk_dir  = "${dest}/networking-ovs-dpdk"
+  $ovs_plugin_git_tag       = 'master'
+
+}
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp
new file mode 100755 (executable)
index 0000000..4a23a89
--- /dev/null
@@ -0,0 +1,74 @@
+# == Class ovsdpdk::postinstall_ovs_dpdk
+#
+# Postinstall configuration of ovs-dpdk service
+#
+class ovsdpdk::postinstall_ovs_dpdk (
+  $plugin_dir               = $::ovsdpdk::params::plugin_dir,
+  $nova_conf                = $::ovsdpdk::params::nova_conf,
+  $openvswitch_service_name = $::ovsdpdk::params::openvswitch_service_name,
+  $ml2_ovs_conf             = $::ovsdpdk::params::ml2_ovs_conf,
+  $neutron_l3_conf          = $::ovsdpdk::params::neutron_l3_conf,
+  $openvswitch_agent        = $::ovsdpdk::params::openvswitch_agent,
+) inherits ovsdpdk {
+
+  require ovsdpdk::install_ovs_dpdk
+
+  package {'crudini': ensure => installed }
+
+  if $compute == 'True' {
+         # adapt configuration files
+         exec {'adapt_nova_conf':
+           command => "${plugin_dir}/files/set_vcpu_pin.sh ${nova_conf}",
+           path    => ['/usr/bin','/bin'],
+           user    => root,
+           onlyif  => "test -f ${nova_conf}",
+           require => Package['crudini'],
+         }
+
+         exec {'adapt_ml2_conf':
+           command => "sudo crudini --set ${ml2_ovs_conf} ovs datapath_type ${ovs_datapath_type}",
+           path    => ['/usr/bin','/bin'],
+           user    => root,
+           onlyif  => "test -f ${ml2_ovs_conf}",
+           require => Package['crudini'],
+         }
+
+         exec {'adapt_neutron_l3':
+           command => "sudo crudini --set ${neutron_l3_conf} DEFAULT external_network_bridge br-ex",
+           path    => ['/usr/bin','/bin'],
+           user    => root,
+           onlyif  => "test -f ${neutron_l3_conf}",
+           require => Package['crudini'],
+         }
+
+
+         service {"${openvswitch_service_name}": ensure => 'running' }
+
+         # restart OVS to synchronize ovsdb-server with ovs-vswitchd needed
+         # due to several new --no-wait entries
+         exec {'restart_ovs':
+           command => "/usr/sbin/service ${openvswitch_service_name} restart",
+           user    => root,
+           require => Service["${openvswitch_service_name}"],
+         }
+
+         exec { "${plugin_dir}/files/configure_bridges.sh ${ovs_datapath_type}":
+        user    => root,
+        require => Exec['restart_ovs'],
+      }
+  }
+
+  if $controller == 'True' {
+    service {'neutron-server':
+       ensure => 'running',
+    }
+  }
+
+  if $compute == 'True' {
+         service {"${openvswitch_agent}":
+           ensure  => 'running',
+           require => [ Exec['restart_ovs'], Service["${openvswitch_service_name}"] ],
+         }
+  }
+
+}
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/uninstall_ovs.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/uninstall_ovs.pp
new file mode 100755 (executable)
index 0000000..97afdd7
--- /dev/null
@@ -0,0 +1,46 @@
+# == Class: ovsdpdk::uninstall_ovs
+#
+# Provides uninstallation of openvswitch package (if present) together with removing of kernel module
+#
+class ovsdpdk::uninstall_ovs (
+  $openvswitch_service_name = $::ovsdpdk::params::openvswitch_service_name,
+  $openvswitch_agent        = $::ovsdpdk::params::openvswitch_agent,
+  $install_packages         = $::ovsdpdk::params::install_packages,
+  $openvswitch_agent        = $::ovsdpdk::params::openvswitch_agent,
+) inherits ovsdpdk {
+
+  #Due to dependencies to other packages, we won't purge vanilla OVS  
+  #package { $remove_packages: ensure => 'purged' }
+
+  if $compute == 'True' {
+         exec { "/usr/sbin/service ${openvswitch_service_name} stop":
+           user => root,
+         }
+
+# This is required for Liberty
+#        exec { "/usr/sbin/service ${openvswitch_agent} stop":
+#          user => root,
+#          path => "/usr/bin:/bin",
+#        }
+  }
+
+  if $controller == 'True' {
+         exec { '/usr/sbin/service neutron-server stop':
+           user => root,
+           path => "/usr/bin:/bin",
+           onlyif => "ps aux |  grep -vws grep | grep -ws neutron-server"
+         }
+  }
+
+  package { $install_packages: ensure => 'installed' }
+
+  if $compute == 'True' {
+         exec { '/sbin/modprobe -r openvswitch':
+           onlyif  => "/bin/grep -q '^openvswitch' '/proc/modules'",
+           user    => root,
+#          require => Exec["/usr/sbin/service ${openvswitch_agent} stop"],
+         }
+  }
+
+}
+
diff --git a/fuel-plugin-ovsnfv/deployment_tasks.yaml b/fuel-plugin-ovsnfv/deployment_tasks.yaml
new file mode 100644 (file)
index 0000000..fe51488
--- /dev/null
@@ -0,0 +1 @@
+[]
diff --git a/fuel-plugin-ovsnfv/environment_config.yaml b/fuel-plugin-ovsnfv/environment_config.yaml
new file mode 100644 (file)
index 0000000..947e225
--- /dev/null
@@ -0,0 +1,7 @@
+attributes:
+  fuel-plugin-ovsnfv_text:
+    value: 'Set default value'
+    label: 'Text field'
+    description: 'Description for text field'
+    weight: 25
+    type: "text"
diff --git a/fuel-plugin-ovsnfv/metadata.yaml b/fuel-plugin-ovsnfv/metadata.yaml
new file mode 100644 (file)
index 0000000..de50b3c
--- /dev/null
@@ -0,0 +1,30 @@
+# Plugin name
+name: fuel-plugin-ovsnfv
+# Human-readable name for your plugin
+title: Userspace OVS support
+# Plugin version
+version: '0.0.1'
+# Description
+description: 'This plugin deploys openvswitch with dpdk'
+# Required fuel version
+fuel_version: ['7.0']
+# Specify license of your plugin
+licenses: ['Apache License Version 2.0']
+# Specify author or company name
+authors: ['Intel Corporation', 'mark.d.gray@intel.com', 'billy.o.mahony@intel.com']
+# A link to the plugin's page
+homepage: 'https://github.com/mrmarkgray/fuel-plugin-ovsnfv'
+# Specify a group which your plugin implements, possible options:
+# network, storage, storage::cinder, storage::glance, hypervisor
+groups: ['network']
+
+# The plugin is compatible with releases in the list
+releases:
+  - os: ubuntu
+    version: 2015.1.0-7.0
+    mode: ['ha', 'multinode']
+    deployment_scripts_path: deployment_scripts/
+    repository_path: repositories/ubuntu
+
+# Version of plugin package
+package_version: '3.0.0'
diff --git a/fuel-plugin-ovsnfv/ovs_package/ubuntu/dependencies.txt b/fuel-plugin-ovsnfv/ovs_package/ubuntu/dependencies.txt
new file mode 100644 (file)
index 0000000..1579e26
--- /dev/null
@@ -0,0 +1,34 @@
+http://archive.ubuntu.com/ubuntu/pool/main/a/autoconf/autoconf_2.69-6_all.deb 
+http://archive.ubuntu.com/ubuntu/pool/main/a/automake-1.14/automake_1.14.1-2ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/a/autotools-dev/autotools-dev_20130810.1_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/m/m4/m4_1.4.17-4_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/p/pcre3/libpcre3_8.31-2ubuntu2.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/libs/libselinux/libselinux1_2.2.2-1ubuntu0.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/libs/libsepol/libsepol1_2.2-1ubuntu0.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/fuse_2.9.2-4ubuntu4.14.04.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/libfuse2_2.9.2-4ubuntu4.14.04.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/p/pcre3/libpcrecpp0_8.31-2ubuntu2.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/libs/libsepol/libsepol1-dev_2.2-1ubuntu0.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/p/pcre3/libpcre3-dev_8.31-2ubuntu2.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/libs/libselinux/libselinux1-dev_2.2.2-1ubuntu0.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/libfuse-dev_2.9.2-4ubuntu4.14.04.1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/libt/libtool/libltdl-dev_2.4.2-1.7ubuntu1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/main/libt/libtool/libtool_2.4.2-1.7ubuntu1_amd64.deb
+http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/p/python-pip/python-pip_1.5.4-1ubuntu3_all.deb
+http://archive.ubuntu.com/ubuntu/pool/universe/c/chardet-whl/python-chardet-whl_2.2.1-2~ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/pool/universe/p/python-colorama/python-colorama_0.2.5-0.1ubuntu2_all.deb
+http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/p/python-colorama/python-colorama-whl_0.2.5-0.1ubuntu2_all.deb
+http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/d/distlib/python-distlib_0.1.8-1ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/d/distlib/python-distlib-whl_0.1.8-1ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/h/html5lib/python-html5lib_0.999-3~ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/h/html5lib/python-html5lib-whl_0.999-3~ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/p/python-pip/python-pip-whl_1.5.4-1ubuntu3_all.deb
+http://archive.ubuntu.com/ubuntu/ubuntu/pool/main/r/requests/python-requests-whl_2.2.1-1ubuntu0.3_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/p/python-setuptools/python-setuptools-whl_3.3-1ubuntu2_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/s/six/python-six-whl_1.5.2-1ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/p/python-urllib3/python-urllib3-whl_1.7.1-1ubuntu4_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/w/wheel/python-wheel_0.24.0-1~ubuntu1_all.deb
+http://archive.ubuntu.com/ubuntu/pool/main/p/python-pbr/python-pbr_0.7.0-0ubuntu2_all.deb
+http://archive.ubuntu.com/ubuntu/pool/universe/c/crudini/crudini_0.3-1_amd64.deb
+http://archive.ubuntu.com/ubuntu/pool/universe/p/python-iniparse/python-iniparse_0.4-2.1build1_all.deb
+https://pypi.python.org/packages/py2.py3/p/pbr/pbr-1.8.1-py2.py3-none-any.whl
diff --git a/fuel-plugin-ovsnfv/pre_build_hook b/fuel-plugin-ovsnfv/pre_build_hook
new file mode 100755 (executable)
index 0000000..c8d1ce3
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+set -eux
+
+BUILD_FOR=${BUILD_FOR:-ubuntu}
+DIR="$(dirname `readlink -f $0`)"
+TMP=${DIR}/tmp
+
+INCLUDE_DEPENDENCIES=${INCLUDE_DEPENDENCIES:-true}
+ovs_ref=${ovs_ref:-master}
+dpdk_ref=${dpdk_ref:-2.1.0}
+networking_ovs_dpdk=${networking_ovs_dpdk:-master}
+
+rm -rf ${TMP}
+mkdir -p ${TMP}
+rm -rf ${DIR}/repositories/${BUILD_FOR}/*
+
+# sudo apt-get install -qq --reinstall --print-uris bash | perl -lne "/'(.*?)'/;print \$1"
+if [ "$INCLUDE_DEPENDENCIES" = true ]
+then
+  wget --content-disposition -N -P ${DIR}/repositories/${BUILD_FOR}/ -i "${DIR}/ovs_package/${BUILD_FOR}/dependencies.txt"
+fi
+
+cd ${TMP}
+
+rm -rf ${TMP}/networking-ovs-dpdk
+git clone https://github.com/openstack/networking-ovs-dpdk ${TMP}/networking-ovs-dpdk
+#rm -rf ${TMP}/networking-ovs-dpdk/.git #Install requires this to be a git repo
+tar cfz ${DIR}/repositories/${BUILD_FOR}/networking-ovs-dpdk.tgz networking-ovs-dpdk
+
+rm -rf ${TMP}/ovs
+git clone https://github.com/openvswitch/ovs  --branch master --single-branch ovs
+rm -rf ${TMP}/ovs/.git
+tar cfz ${DIR}/repositories/${BUILD_FOR}/ovs.tgz ovs
+
+rm -rf ${TMP}/dpdk
+git clone http://dpdk.org/git/dpdk --branch v2.1.0 --single-branch dpdk
+rm -rf ${TMP}/dpdk/.git
+tar cfz ${DIR}/repositories/${BUILD_FOR}/dpdk.tgz dpdk
+
+cd -
+rm -rf ${TMP}
+
diff --git a/fuel-plugin-ovsnfv/tasks.yaml b/fuel-plugin-ovsnfv/tasks.yaml
new file mode 100644 (file)
index 0000000..c418e20
--- /dev/null
@@ -0,0 +1,14 @@
+- role: ['compute']
+  stage: post_deployment/8999
+  type: puppet
+  parameters:
+    puppet_manifest: puppet/manifests/ovs-install-ovsnfv-compute.pp
+    puppet_modules: puppet/modules:/etc/puppet/modules
+    timeout: 720
+- role: ['controller']
+  stage: post_deployment/8998
+  type: puppet
+  parameters:
+    puppet_manifest: puppet/manifests/ovs-install-ovsnfv-controller.pp
+    puppet_modules: puppet/modules:/etc/puppet/modules
+    timeout: 720