summaryrefslogtreecommitdiffstats
path: root/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk
diff options
context:
space:
mode:
Diffstat (limited to 'fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk')
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/build_ovs_dpdk.erb36
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh45
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh25
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/kvm-wrapper.sh46
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf13
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service11
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/ovs-dpdk-conf.erb28
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh24
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/tune_params.sh86
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/build_ovs_dpdk.pp20
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/clone.pp49
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/init.pp131
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp76
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/params.pp61
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp74
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/uninstall_ovs.pp46
16 files changed, 771 insertions, 0 deletions
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
index 0000000..215d0b1
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/build_ovs_dpdk.erb
@@ -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
index 0000000..9110b45
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh
@@ -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
index 0000000..c77258f
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh
@@ -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
index 0000000..ea98408
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/kvm-wrapper.sh
@@ -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
index 0000000..185ae8e
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf
@@ -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
index 0000000..f46f9c7
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service
@@ -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
index 0000000..4fd8604
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/ovs-dpdk-conf.erb
@@ -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
index 0000000..0cb3791
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh
@@ -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
index 0000000..e9908e4
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/tune_params.sh
@@ -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
index 0000000..ad0b712
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/build_ovs_dpdk.pp
@@ -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
index 0000000..255de0e
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/clone.pp
@@ -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
index 0000000..de5b362
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/init.pp
@@ -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
index 0000000..2b446de
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp
@@ -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
index 0000000..3d7bdfa
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/params.pp
@@ -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
index 0000000..4a23a89
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp
@@ -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
index 0000000..97afdd7
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/uninstall_ovs.pp
@@ -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"],
+ }
+ }
+
+}
+