summaryrefslogtreecommitdiffstats
path: root/testing/puppet-fdio/manifests
diff options
context:
space:
mode:
authorJuraj Linkeš <jlinkes@cisco.com>2016-08-15 08:10:08 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-08-15 08:10:08 +0000
commit3285c8e93ea59d98b392591ef6dfa5b1de3bb92d (patch)
tree795fe6b7263a4a3b5b06ce5f750ec883037d4346 /testing/puppet-fdio/manifests
parent7ac44c4a1406bf060911c645f23eef18a13dc0af (diff)
parent9dd5d7bf353fe5ffd478ff811bb6b26538afe092 (diff)
Merge "puppet module added"
Diffstat (limited to 'testing/puppet-fdio/manifests')
-rw-r--r--testing/puppet-fdio/manifests/honeycomb.pp14
-rw-r--r--testing/puppet-fdio/manifests/honeycomb/install.pp18
-rw-r--r--testing/puppet-fdio/manifests/honeycomb/service.pp12
-rw-r--r--testing/puppet-fdio/manifests/init.pp51
-rw-r--r--testing/puppet-fdio/manifests/install.pp34
-rw-r--r--testing/puppet-fdio/manifests/params.pp14
-rw-r--r--testing/puppet-fdio/manifests/test.pp2
-rw-r--r--testing/puppet-fdio/manifests/vpp.pp25
-rw-r--r--testing/puppet-fdio/manifests/vpp/config.pp18
-rw-r--r--testing/puppet-fdio/manifests/vpp/install.pp18
-rw-r--r--testing/puppet-fdio/manifests/vpp/service.pp20
11 files changed, 226 insertions, 0 deletions
diff --git a/testing/puppet-fdio/manifests/honeycomb.pp b/testing/puppet-fdio/manifests/honeycomb.pp
new file mode 100644
index 0000000..2471b2e
--- /dev/null
+++ b/testing/puppet-fdio/manifests/honeycomb.pp
@@ -0,0 +1,14 @@
+# == Class: fdio::honeycomb
+#
+# fd.io::honeycomb
+#
+class fdio::honeycomb (
+ $install_method = $::fdio::params::install_method,
+) inherits ::fdio {
+
+ class { '::fdio::honeycomb::install':
+ install_method => $install_method,
+ } ->
+ class { '::fdio::honeycomb::service': } ->
+ Class['::fdio']
+}
diff --git a/testing/puppet-fdio/manifests/honeycomb/install.pp b/testing/puppet-fdio/manifests/honeycomb/install.pp
new file mode 100644
index 0000000..2103cae
--- /dev/null
+++ b/testing/puppet-fdio/manifests/honeycomb/install.pp
@@ -0,0 +1,18 @@
+# == Class fdio::honeycomb::install
+#
+# Manages the installation of fdio.
+#
+class fdio::honeycomb::install (
+ $install_method = $::fdio::params::install_method,
+) inherits fdio::install {
+ if $fdio::install_method == 'rpm' {
+ # Install the HC RPM
+ package { 'honeycomb':
+ ensure => present,
+ require => Yumrepo['fdio-master'],
+ }
+ }
+ else {
+ fail("Unknown install method: ${fdio::install_method}")
+ }
+}
diff --git a/testing/puppet-fdio/manifests/honeycomb/service.pp b/testing/puppet-fdio/manifests/honeycomb/service.pp
new file mode 100644
index 0000000..58f7ae3
--- /dev/null
+++ b/testing/puppet-fdio/manifests/honeycomb/service.pp
@@ -0,0 +1,12 @@
+# == Class fdio::honeycomb::service
+#
+# Starts the honeycomb systemd or Upstart service.
+#
+class fdio::honeycomb::service {
+ service { 'honeycomb':
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ hasrestart => true,
+ }
+}
diff --git a/testing/puppet-fdio/manifests/init.pp b/testing/puppet-fdio/manifests/init.pp
new file mode 100644
index 0000000..ee6d25d
--- /dev/null
+++ b/testing/puppet-fdio/manifests/init.pp
@@ -0,0 +1,51 @@
+# == Class: fdio
+#
+# fd.io
+#
+# === Parameters
+# [* vpp_port *]
+# Port for VPP to listen on.
+# [* dpdk_pmd_driver *]
+# Sets VPP's uio-driver value
+class fdio inherits ::fdio::params {
+
+ # Validate OS family
+ case $::osfamily {
+ 'RedHat': {}
+ 'Debian': {
+ warning('Debian has limited support, is less stable, less tested.')
+ }
+ default: {
+ fail("Unsupported OS family: ${::osfamily}")
+ }
+ }
+
+ # Validate OS
+ case $::operatingsystem {
+ centos, redhat: {
+ if $::operatingsystemmajrelease != '7' {
+ # RHEL/CentOS versions < 7 not supported as they lack systemd
+ fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
+ }
+ }
+ fedora: {
+ # Fedora distros < 22 are EOL as of 2015-12-01
+ # https://fedoraproject.org/wiki/End_of_life
+ if $::operatingsystemmajrelease < '22' {
+ fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
+ }
+ }
+ ubuntu: {
+ if $::operatingsystemmajrelease != '14.04' {
+ # Only tested on 14.04
+ fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
+ }
+ }
+ default: {
+ fail("Unsupported OS: ${::operatingsystem}")
+ }
+ }
+
+ class { '::fdio::install': } ->
+ Class['::fdio']
+}
diff --git a/testing/puppet-fdio/manifests/install.pp b/testing/puppet-fdio/manifests/install.pp
new file mode 100644
index 0000000..ddba26b
--- /dev/null
+++ b/testing/puppet-fdio/manifests/install.pp
@@ -0,0 +1,34 @@
+# == Class fdio::install
+#
+# Manages the installation of fdio.
+#
+class fdio::install (
+ $install_method = $::fdio::params::install_method,
+){
+ if $install_method == 'rpm' {
+ # Choose Yum URL based on OS (CentOS vs Fedora)
+ # NB: Currently using the CentOS CBS for both Fedora and CentOS
+ $base_url = $::operatingsystem ? {
+ 'CentOS' => 'https://nexus.fd.io/content/repositories/fd.io.master.centos7/',
+ 'Fedora' => 'https://nexus.fd.io/content/repositories/fd.io.master.centos7/',
+ }
+
+ # Add fdio's Yum repository
+ yumrepo { 'fdio-master':
+ # 'ensure' isn't supported with Puppet <3.5
+ # Seems to default to present, but docs don't say
+ # https://docs.puppetlabs.com/references/3.4.0/type.html#yumrepo
+ # https://docs.puppetlabs.com/references/3.5.0/type.html#yumrepo
+ baseurl => $base_url,
+ descr => 'fd.io master branch latest merge',
+ enabled => 1,
+ # NB: RPM signing is an active TODO, but is not done. We will enable
+ # this gpgcheck once the RPM supports it.
+ gpgcheck => 0,
+ }
+
+ }
+ else {
+ fail("Unknown install method: ${fdio::install_method}")
+ }
+}
diff --git a/testing/puppet-fdio/manifests/params.pp b/testing/puppet-fdio/manifests/params.pp
new file mode 100644
index 0000000..01908c3
--- /dev/null
+++ b/testing/puppet-fdio/manifests/params.pp
@@ -0,0 +1,14 @@
+# == Class fdio::params
+#
+# This class manages the default params for the ODL class.
+#
+class fdio::params {
+ # NB: If you update the default values here, you'll also need to update:
+ # spec/spec_helper_acceptance.rb's install_odl helper fn
+ # spec/classes/fdio_spec.rb tests that use default Karaf features
+ # Else, both the Beaker and RSpec tests will fail
+ # TODO: Remove this possible source of bugs^^
+ $install_method = 'rpm'
+ $dpdk_pmd_type = 'uio_pci_generic'
+ $dpdk_pci_devs = []
+}
diff --git a/testing/puppet-fdio/manifests/test.pp b/testing/puppet-fdio/manifests/test.pp
new file mode 100644
index 0000000..6317bda
--- /dev/null
+++ b/testing/puppet-fdio/manifests/test.pp
@@ -0,0 +1,2 @@
+class { '::fdio::vpp': }
+class { '::fdio::honeycomb': }
diff --git a/testing/puppet-fdio/manifests/vpp.pp b/testing/puppet-fdio/manifests/vpp.pp
new file mode 100644
index 0000000..bf23901
--- /dev/null
+++ b/testing/puppet-fdio/manifests/vpp.pp
@@ -0,0 +1,25 @@
+# == Class: fdio::vpp
+#
+# fd.io::vpp
+#
+# === Parameters
+# [* vpp_port *]
+# Port for VPP to listen on.
+# [* dpdk_pmd_driver *]
+# Sets VPP's uio-driver value
+class fdio::vpp (
+ $install_method = $::fdio::params::install_method,
+ $dpdk_pmd_type = $::fdio::params::dpdk_pmd_type,
+ $dpdk_pci_devs = $::fdio::params::dpdk_pci_devs,
+) inherits ::fdio {
+
+ class { '::fdio::vpp::install':
+ install_method => $install_method,
+ } ->
+ class { '::fdio::vpp::config':
+ dpdk_pmd_type => $dpdk_pmd_type,
+ dpdk_pci_devs => $dpdk_pci_devs,
+ } ~>
+ class { '::fdio::vpp::service': } ->
+ Class['::fdio::vpp']
+}
diff --git a/testing/puppet-fdio/manifests/vpp/config.pp b/testing/puppet-fdio/manifests/vpp/config.pp
new file mode 100644
index 0000000..96c3497
--- /dev/null
+++ b/testing/puppet-fdio/manifests/vpp/config.pp
@@ -0,0 +1,18 @@
+# == Class fdio::vpp::config
+#
+# This class handles vpp config changes.
+#
+class fdio::vpp::config (
+ $dpdk_pmd_type = $::fdio::params::dpdk_pmd_type,
+ $dpdk_pci_devs = $::fdio::params::dpdk_pci_devs,
+){
+ file { '/etc/vpp/startup.conf':
+ content => template('fdio/startup.conf.erb'),
+ }
+
+ # ensure that uio-pci-generic is loaded
+ exec { 'modprobe uio-pci-generic':
+ unless => 'lsmod | grep uio-pci-generic',
+ path => '/bin:/sbin',
+ }
+}
diff --git a/testing/puppet-fdio/manifests/vpp/install.pp b/testing/puppet-fdio/manifests/vpp/install.pp
new file mode 100644
index 0000000..3ae4f87
--- /dev/null
+++ b/testing/puppet-fdio/manifests/vpp/install.pp
@@ -0,0 +1,18 @@
+# == Class fdio::vpp::install
+#
+# Manages the installation of vpp.
+#
+class fdio::vpp::install (
+ $install_method = $::fdio::params::install_method,
+) inherits fdio::install {
+ if $install_method == 'rpm' {
+ # Install the VPP RPM
+ package { 'vpp':
+ ensure => present,
+ require => Yumrepo['fdio-master'],
+ }
+ }
+ else {
+ fail("Unknown install method: ${fdio::install_method}")
+ }
+}
diff --git a/testing/puppet-fdio/manifests/vpp/service.pp b/testing/puppet-fdio/manifests/vpp/service.pp
new file mode 100644
index 0000000..7453695
--- /dev/null
+++ b/testing/puppet-fdio/manifests/vpp/service.pp
@@ -0,0 +1,20 @@
+# == Class fdio::vpp::service
+#
+# Starts the VPP systemd or Upstart service.
+#
+class fdio::vpp::service {
+ # TODO
+ # bring interfaces down before service start
+ # so vpp can bind
+ service { 'vpp':
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ hasrestart => true,
+ }
+ # TODO
+ #sudo vppctl set interface ip address TenGigabitEthernet7/0/0 192.168.21.21/24
+ #sudo vppctl set interface state TenGigabitEthernet7/0/0 up
+
+
+}