Add .deb support to puppet-opendaylight 56/55656/1
authorAkshita Jha <zenith158@gmail.com>
Sat, 25 Feb 2017 08:43:57 +0000 (14:13 +0530)
committerDaniel Farrell <dfarrell@redhat.com>
Wed, 19 Apr 2017 19:18:40 +0000 (15:18 -0400)
This patch adds .deb support to puppet-odl. It adds beaker tests for Ubuntu 16.04.

This removes the tarball install method logic for both RedHat and Debian based OSs.
It adds logic that looks at the OS and decides the install repo: `rpm_repo` or `deb_repo`.
Addtionally, this patch adds `lsbdist`* facts for Ubuntu tests.

This also updates the README.md to reflect these changes.

Change-Id: I05490087b57dd04558388c68d67a390d10ca52c6
Signed-off-by: Akshita Jha <zenith158@gmail.com>
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
12 files changed:
.fixtures.yml
README.markdown
Rakefile
manifests/init.pp
manifests/install.pp
manifests/params.pp
spec/acceptance/class_spec.rb
spec/acceptance/nodesets/ubuntu-16-docker.yml [new file with mode: 0644]
spec/acceptance/nodesets/ubuntu-16.yml [new file with mode: 0644]
spec/classes/opendaylight_spec.rb
spec/spec_helper.rb
spec/spec_helper_acceptance.rb

index 7023bd1909d9a2502565a6c425ba41eb9410f18a..d0b68c9b18275d898d627fb357806cc37e15da83 100644 (file)
@@ -2,6 +2,7 @@
 fixtures:
   repositories:
     stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
+    apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
     archive: "https://github.com/dfarrell07/puppet-archive"
     java: "https://github.com/puppetlabs/puppetlabs-java"
   symlinks:
index 444381ffa54582bd486a16889cf9ada63cd2d991..b7222d534ddf9eb1573b97ddcaeb952e54aa9749 100644 (file)
@@ -12,8 +12,8 @@
   - [Beginning with `opendaylight`](#beginning-with-opendaylight)
 4. [Usage](#usage)
   - [Karaf Features](#karaf-features)
-  - [Install Method](#install-method)
   - [RPM Repo](#rpm-repo)
+  - [Deb Repo](#deb-repo)
   - [Ports](#ports)
   - [Log Verbosity](#log-verbosity)
   - [Enabling ODL OVSDB HA](#enabling-odl-ovsdb-ha)
@@ -29,16 +29,15 @@ Networking (SDN) controller][7].
 
 ## Module Description
 
-Deploys OpenDaylight to various OSs either via an RPM or directly from the
-ODL tarball release artifact.
+Deploys OpenDaylight to various OSs either via an RPM or a Deb.
 
 All OpenDaylight configuration should be handled through the ODL Puppet
 module's [params](#parameters). If you need a new knob, [please raise an
 Issue][8].
 
-The master branch installs OpenDaylight from the latest testing RPM repository
-by default. There are stable/<release> branches that install OpenDaylight
-releases and service releases, like Beryllium or Beryllium SR3.
+By default, the master branch installs OpenDaylight from the latest testing RPM repository
+or from the latest stable Deb repository depending on the OS. There are stable/<release>
+branches that install OpenDaylight releases and service releases, like Beryllium or Beryllium SR3.
 
 ## Setup
 
@@ -47,11 +46,10 @@ releases and service releases, like Beryllium or Beryllium SR3.
 - Installs Java, which is required by ODL.
 - Creates `odl:odl` user:group if they don't already exist.
 - Installs [OpenDaylight][7].
-- Installs a [systemd unitfile][9] or [Upstart config file][10] for
-  OpenDaylight.
+- Installs a [systemd unitfile][9] for OpenDaylight.
 - Manipulates OpenDaylight's configuration files according to the params
   passed to the `::opendaylight` class.
-- Starts the `opendaylight` systemd or Upstart service.
+- Starts the `opendaylight` systemd service.
 
 ### Beginning with `opendaylight`
 
@@ -59,33 +57,48 @@ Getting started with the OpenDaylight Puppet module is as simple as declaring
 the `::opendaylight` class.
 
 The [vagrant-opendaylight][11] project provides an easy way to experiment
-with [applying the ODL Puppet module][12] to CentOS 7, Fedora 22 and Fedora
-23 Vagrant boxes.
+with [applying the ODL Puppet module][12] to CentOS 7, Fedora 22, Fedora
+23 and Ubuntu 16.04 Vagrant boxes.
 
 ```
 [~/vagrant-opendaylight]$ vagrant status
 Current machine states:
 
-cent7                     not created (libvirt)
-cent7_rpm_he_sr4          not created (libvirt)
-cent7_rpm_li_sr2          not created (libvirt)
-cent7_rpm_be              not created (libvirt)
-cent7_ansible             not created (libvirt)
-cent7_ansible_be          not created (libvirt)
-cent7_ansible_path        not created (libvirt)
-cent7_pup_rpm             not created (libvirt)
-cent7_pup_custom_logs     not created (libvirt)
-cent7_pup_tb              not created (libvirt)
-f22_rpm_li                not created (libvirt)
-f22_ansible               not created (libvirt)
-f22_pup_rpm               not created (libvirt)
-f23_rpm_li                not created (libvirt)
-f23_rpm_li_sr1            not created (libvirt)
-f23_rpm_li_sr2            not created (libvirt)
-f23_rpm_li_sr3            not created (libvirt)
-f23_rpm_be                not created (libvirt)
-f23_ansible               not created (libvirt)
-f23_pup_rpm               not created (libvirt)
+cent7_li_sr4              not created (virtualbox)
+cent7_be                  not created (virtualbox)
+cent7_be_sr1              not created (virtualbox)
+cent7_be_sr2              not created (virtualbox)
+cent7_rpm_he_sr4          not created (virtualbox)
+cent7_rpm_li_sr2          not created (virtualbox)
+cent7_rpm_li_sr3          not created (virtualbox)
+cent7_rpm_be              not created (virtualbox)
+cent7_rpm_be_sr1          not created (virtualbox)
+cent7_rpm_be_sr2          not created (virtualbox)
+cent7_rpm_ve_latest       not created (virtualbox)
+cent7_ansible             not created (virtualbox)
+cent7_ansible_latest      not created (virtualbox)
+cent7_ansible_path        not created (virtualbox)
+cent7_pup_rpm             not created (virtualbox)
+cent7_pup_custom_logs     not created (virtualbox)
+cent7_pup_enable_l3       not created (virtualbox)
+cent7_pup_tb              not created (virtualbox)
+f22_rpm_li                not created (virtualbox)
+f22_ansible               not created (virtualbox)
+f22_pup_rpm               not created (virtualbox)
+f23_rpm_li                not created (virtualbox)
+f23_rpm_li_sr1            not created (virtualbox)
+f23_rpm_li_sr2            not created (virtualbox)
+f23_rpm_li_sr3            not created (virtualbox)
+f23_rpm_be                not created (virtualbox)
+f23_rpm_be_rel            not created (virtualbox)
+f23_rpm_be_latest         not created (virtualbox)
+f23_ansible               not created (virtualbox)
+f23_pup_rpm               not created (virtualbox)
+debian8_ansible_repo      not created (virtualbox)
+debian8_ansible_path      not created (virtualbox)
+ubuntu16_ansible_repo     not created (virtualbox)
+ubuntu16_ansible_path     not created (virtualbox)
+ubuntu16_pup_deb          not created (virtualbox)
 
 [~/vagrant-opendaylight]$ vagrant up cent7_pup_rpm
 # A CentOS 7 VM is created and configured using the ODL Puppet mod's defaults
@@ -128,30 +141,6 @@ class { 'opendaylight':
 }
 ```
 
-### Install Method
-
-The `install_method` param, and the associated `tarball_url` and `unitfile_url`
-params, are intended for use by developers who need to install a custom-built
-version of OpenDaylight, or for automated build processes that need to consume
-a tarball build artifact.
-
-It's recommended that most people use the default RPM-based install.
-
-If you do need to install from a tarball, simply pass `tarball` as the value
-for `install_method` and optionally pass the URL to your tarball via the
-`tarball_url` param. The default value for `tarball_url` points at
-OpenDaylight's latest release. The `unitfile_url` param points at the
-OpenDaylight systemd .service file used by the RPM and should (very likely)
-not need to be overridden.
-
-```puppet
-class { 'opendaylight':
-  install_method => 'tarball',
-  tarball_url    => '<URL to your custom tarball>',
-  unitfile_url   => '<URL to your custom unitfile>',
-}
-```
-
 ### RPM Repo
 
 The `rpm_repo` param can be used to configure which RPM repository
@@ -178,7 +167,26 @@ Service Releases, like SR2 4.2).
 For a full list of OpenDaylight releases and their CBS repos, see the
 [OpenDaylight Deployment wiki][19].
 
-This is only read when `install_method` is `rpm`.
+This is only read for RedHat based operating systems. For Debian based OSs,
+this values is `none`.
+
+### Deb Repo
+
+The `deb_repo` param can be used to configure which Deb repository
+OpenDaylight is installed from.
+
+```puppet
+class { 'opendaylight':
+  deb_repo => 'ppa:odl-team/boron',
+}
+```
+
+The naming convention is same as the naming convention of Launchpad PPA's,
+which is where ODL .debs are hosted. The `ppa:odl-team/boron` example above
+would install OpenDaylight Boron realease from the [odl-team's boron][20] repo.
+
+This is only read for Debian based operating systems. For RedHat based OSs,
+this values is `none`.
 
 ### Ports
 
@@ -232,7 +240,7 @@ class { 'opendaylight':
 #### Private classes
 
 - `::opendaylight::params`: Contains default `opendaylight` class param values.
-- `::opendaylight::install`: Installs ODL from an RPM or tarball.
+- `::opendaylight::install`: Installs ODL from an RPM or a Deb.
 - `::opendaylight::config`: Manages ODL config, including Karaf features and
   REST port.
 - `::opendaylight::service`: Starts the OpenDaylight service.
@@ -261,17 +269,6 @@ Default: `[]`
 
 Valid options: A list of Karaf feature names as strings.
 
-##### `install_method`
-
-Specifies the install method by which to install OpenDaylight.
-
-The RPM install method is less complex, more frequently consumed and
-recommended.
-
-Default: `'rpm'`
-
-Valid options: The strings `'tarball'` or `'rpm'`.
-
 ##### `odl_rest_port`
 
 Specifies the port for the ODL northbound REST interface to listen on.
@@ -280,6 +277,16 @@ Default: `'8080'`
 
 Valid options: A valid port number as a string or integer.
 
+##### `rpm_repo`
+
+OpenDaylight CentOS CBS repo to install RPM from (opendaylight-4-testing,
+opendaylight-40-release, ...).
+
+##### `deb_repo`
+
+OpenDaylight Launchpad PPA repo to install .deb from (ppa:odl-team/boron,
+ppa:odl-team/carbon, ...).
+
 ##### `log_levels`
 
 Custom OpenDaylight logger verbosity configuration.
@@ -350,27 +357,6 @@ Valid options: Index of a member of the array `ha_node_ips`: `0`.
 
 Required by: `enable_ha`, `ha_node_ips`
 
-##### `tarball_url`
-
-Specifies the ODL tarball to use when installing via the tarball install
-method.
-
-Default: `'https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.3.2-Lithium-SR2/distribution-karaf-0.3.2-Lithium-SR2.tar.gz'`
-
-Valid options: A valid URL to an ODL tarball as a string.
-
-##### `unitfile_url`
-
-Specifies the ODL systemd .service file to use when installing via the tarball
-install method.
-
-It's very unlikely that you'll need to override this.
-
-Default: `'https://github.com/dfarrell07/opendaylight-systemd/archive/master/opendaylight-unitfile.tar.gz'`
-
-Valid options: A valid URL to an ODL systemd .service file (archived in a
-tarball) as a string.
-
 ##### `security_group_mode`
 
 Specifies the mode to use for security groups.
@@ -398,10 +384,8 @@ Valid options: A string of valid Java options.
 
 ## Limitations
 
-- Tested on Fedora 22, 23, CentOS 7 and Ubuntu 14.04.
+- Tested on Fedora 22, 23, CentOS 7 and Ubuntu 16.04.
 - CentOS 7 is currently the most stable OS option.
-- The RPM install method is likely more reliable than the tarball install
-  method.
 
 ## Development
 
@@ -445,5 +429,8 @@ See our [git commit history][17] for contributor information.
 
 [17]: https://github.com/dfarrell07/puppet-opendaylight/commits/master
 
-[18]&#x3A; <http://cbs.centos.org/repos/nfv7-opendaylight-40-release/x86_64/os/Packages/> OpenDaylight Beryllium CentOS CBS repo
-[19]&#x3A; <https://wiki.opendaylight.org/view/Deployment#RPM> OpenDaylight RPMs and their repos
+[18]: <http://cbs.centos.org/repos/nfv7-opendaylight-40-release/x86_64/os/Packages/> "OpenDaylight Beryllium CentOS CBS repo"
+
+[19]: <https://wiki.opendaylight.org/view/Deployment#RPM> "OpenDaylight RPMs and their repos"
+
+[20]: https://launchpad.net/~odl-team/+archive/ubuntu/boron
index 9091d94ce94beff355dde25ebd7145a36bb645ad..3350bb59a09d63bcfdebc151434ec9044b4d6c08 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -82,6 +82,21 @@ task :cent_5rel_dock do
   sh "RS_SET=centos-7-docker INSTALL_METHOD=rpm RPM_REPO='opendaylight-5-release' bundle exec rake beaker"
 end
 
+# Ubuntu VMs
+
+desc "Beaker tests against Ubuntu 16.04 VM with Boron release Deb"
+task :ubuntu_5rel_vm do
+  sh "RS_SET=ubuntu-16 INSTALL_METHOD=deb DEB_REPO='ppa:odl-team/boron' bundle exec rake beaker"
+end
+
+# Ubuntu Containers
+
+desc "Beaker tests against Ubuntu 16.04 Container with Boron release Deb"
+task :ubuntu_5rel_dock do
+  sh "RS_SET=ubuntu-16-docker INSTALL_METHOD=deb DEB_REPO='ppa:odl-team/boron' bundle exec rake beaker"
+end
+
+
 # Multi-test helpers
 
 desc "Run syntax, lint, and spec tests."
@@ -103,6 +118,7 @@ desc "All tests, use VMs for Beaker tests"
 task :acceptance_vm => [
   :test,
   :cent_5rel_vm,
+  :ubuntu_5rel_vm,
   :cent_5test_vm,
   :cent_6test_vm,
 ]
@@ -111,6 +127,7 @@ desc "All tests, use containers for Beaker tests"
 task :acceptance_dock => [
   :test,
   :cent_5rel_dock,
+  :ubuntu_5rel_dock,
   :cent_5test_dock,
   :cent_6test_dock,
 ]
index d31ffb467202718abe054af945ded59120f98d98..563291d7107768c6e8e4e00944c74b5b78511f87 100644 (file)
 #   Port for ODL northbound REST interface to listen on.
 # [*odl_bind_ip *]
 #   IP for ODL northbound REST interface to bind to.
-# [*install_method *]
-#   How to install OpenDaylight. Current options are "rpm" and "tarball",
-#   default is RPM.
 # [*rpm_repo*]
 #   OpenDaylight CentOS CBS repo to install RPM from (opendaylight-4-testing,
 #   opendaylight-40-release, ...).
-# [*tarball_url*]
-#   If installing from a tarball, use this one. Defaults to latest ODL.
-# [*unitfile_url*]
-#   OpenDaylight .service file to use for tarball installs. Defaults to one
-#   used by ODL RPM.
+# [*deb_repo*]
+#   OpenDaylight Launchpad PPA repo to install .deb from (ppa:odl-team/boron,
+#   ppa:odl-team/carbon, ...).
 # [*log_levels*]
 #   Custom OpenDaylight logger verbosity configuration (TRACE, DEBUG, INFO, WARN, ERROR).
 # [*enable_ha*]
@@ -44,10 +39,8 @@ class opendaylight (
   $extra_features      = $::opendaylight::params::extra_features,
   $odl_rest_port       = $::opendaylight::params::odl_rest_port,
   $odl_bind_ip         = $::opendaylight::params::odl_bind_ip,
-  $install_method      = $::opendaylight::params::install_method,
   $rpm_repo            = $::opendaylight::params::rpm_repo,
-  $tarball_url         = $::opendaylight::params::tarball_url,
-  $unitfile_url        = $::opendaylight::params::unitfile_url,
+  $deb_repo            = $::opendaylight::params::deb_repo,
   $log_levels          = $::opendaylight::params::log_levels,
   $enable_ha           = $::opendaylight::params::enable_ha,
   $ha_node_ips         = $::opendaylight::params::ha_node_ips,
@@ -89,9 +82,9 @@ class opendaylight (
       }
     }
     ubuntu: {
-      if $::operatingsystemmajrelease != '14.04' {
-        # Only tested on 14.04
-        fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
+      if $::operatingsystemrelease < '16.04' {
+        # Only tested on 16.04
+        fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemrelease}")
       }
     }
     default: {
index c45d5f3dc3b855a2500c3c6fd4d5895e1134cefd..2af09c5ff479f429223870ebdb4f880e789c6b6c 100644 (file)
@@ -2,12 +2,11 @@
 #
 # Manages the installation of OpenDaylight.
 #
-# There are two install methods: RPM-based and tarball-based. The resulting
-# system state should be functionally equivalent, but we have to do more
-# work here for the tarball method (would normally be handled by the RPM).
+# There are two install methods: RPM-based and deb-based. The resulting
+# system state should be functionally equivalent.
 #
 class opendaylight::install {
-  if $opendaylight::install_method == 'rpm' {
+  if $::osfamily == 'RedHat' {
     # Add OpenDaylight's Yum repository
     yumrepo { $opendaylight::rpm_repo:
       # 'ensure' isn't supported with Puppet <3.5
@@ -43,129 +42,23 @@ class opendaylight::install {
       path    => '/bin'
     }
   }
-  elsif $opendaylight::install_method == 'tarball' {
-    # Install Java 7
-    $package = $::osfamily ? {
-      'RedHat' => 'java-1.7.0-openjdk',
-      'Debian' => 'openjdk-7-jdk',
-    }
-    class { 'java':
-      # NB: ODL is currently in the process of moving to Java 8
-      package => $package,
-    }
 
-    # Create and configure the odl user
-    user { 'odl':
-      ensure     => present,
-      # Must be a valid dir for the auto-creation of some files
-      home       => '/opt/opendaylight/',
-      # The odl user should, at the minimum, be a member of the odl group
-      membership => 'minimum',
-      groups     => 'odl',
-      # The odl user's home dir should exist before the user is created
-      # The odl group, to which the odl user will belong, should exist
-      require    => [Archive['opendaylight'], Group['odl']],
-      # The odl user will own this dir, user should exist before we set owner
-      before     => File['/opt/opendaylight/'],
-    }
+  elsif $::osfamily == 'Debian'{
 
-    # Create and configure the odl group
-    group { 'odl':
-      ensure => present,
-      # The odl user will be a member of this group, create it first
-      # The odl user will own ODL's dir, so should exist before owner set 
-      before => [File['/opt/opendaylight/'], User['odl']],
-    }
+    include apt
 
-    # Download and extract the ODL tarball
-    archive { 'opendaylight':
-      ensure           => present,
-      # URL from which ODL's tarball can be downloaded
-      url              => $opendaylight::tarball_url,
-      # Will end up installing /opt/opendaylight/
-      target           => '/opt/opendaylight/',
-      # ODL doesn't provide a checksum in the expected path, would fail
-      checksum         => false,
-      # This discards top-level dir of extracted tarball
-      # Required to get proper /opt/opendaylight/ path
-      strip_components => 1,
-      root_dir         => '.',
-      # Default timeout is 120s, which may not be enough. See Issue #53:
-      # https://github.com/dfarrell07/puppet-opendaylight/issues/53
-      timeout          => 600,
-      # ODL's archive should be dl'd/extracted before we config mode/user/group
-      # The odl user will set this to their home dir, should exist before user
-      before           => [File['/opt/opendaylight/'], User['odl']],
-    }
+    # Add ODL ppa repository
+    apt::ppa{ $opendaylight::deb_repo: }
 
-    # Set the user:group owners and mode of ODL dir
-    file { '/opt/opendaylight/':
-      # ensure=>dir and recurse=>true are required for managing recursively
-      ensure  => 'directory',
-      recurse => true,
-      # Set user:group owners of ODL dir
-      owner   => 'odl',
-      group   => 'odl',
-      # The ODL archive we're modifying should exist
-      # Since ODL's dir is owned by odl:odl, that user:group should exist
-      require => [Archive['opendaylight'], Group['odl'], User['odl']],
+    # Install Opendaylight .deb pkg
+    package { 'opendaylight':
+      ensure  => present,
+      require => Apt::Ppa[$opendaylight::deb_repo],
     }
 
-    # Systemd vs upstart config depends on OS family
-    if ( $::osfamily == 'RedHat' ) {
-      # Download ODL systemd .service file and put in right location
-      archive { 'opendaylight-systemd':
-        ensure           => present,
-        url              => $opendaylight::unitfile_url,
-        # Will end up installing /usr/lib/systemd/system/opendaylight.service
-        target           => '/usr/lib/systemd/system/',
-        # Required by archive mod for correct exec `creates` param
-        root_dir         => 'opendaylight.service',
-        # ODL doesn't provide a checksum in the expected path, would fail
-        checksum         => false,
-        # This discards top-level dir of extracted tarball
-        # Required to get proper /opt/opendaylight-<version> path
-        strip_components => 1,
-        # May end up with an HTML redirect output in a text file without this
-        # Note that the curl'd down file would still have a .tar.gz name
-        follow_redirects => true,
-        # Should exist before we try to set its user/group/mode
-        before           => File['/usr/lib/systemd/system/opendaylight.service'],
-      }
-
-      # Set the user:group owners and mode of ODL's systemd .service file
-      file { '/usr/lib/systemd/system/opendaylight.service':
-        # It should be a normal file
-        ensure  => 'file',
-        # Set user:group owners of ODL systemd .service file
-        owner   => 'root',
-        group   => 'root',
-        # Set mode of ODL systemd .service file
-        mode    => '0644',
-        # Should happen after the ODL systemd .service file has been extracted
-        require => Archive['opendaylight-systemd'],
-      }
-    }
-    elsif ( $::osfamily == 'Debian' ) {
-      file { '/etc/init/opendaylight.conf':
-        # It should be a normal file
-        ensure => 'file',
-        # Set user:group owners of ODL upstart file
-        # NB: Unverfied, not sure if this is correct for upstart
-        owner  => 'root',
-        group  => 'root',
-        # Set mode of ODL upstart file
-        # NB: Unverfied, not sure if this is correct for upstart
-        mode   => '0644',
-        # Use Puppet URL for Travis. File stored in <mod name>/files/
-        source => 'puppet:///modules/opendaylight/upstart.odl.conf'
-      }
-    }
-    else {
-      fail("Unsupported OS family: ${::osfamily}")
-    }
+    Apt::Ppa[$opendaylight::deb_repo] -> Package['opendaylight']
   }
   else {
-    fail("Unknown install method: ${opendaylight::install_method}")
+    fail("Unknown operating system method: ${::osfamily}")
   }
 }
index 1e0aa68be77fb74789c60c4b86317cacef477832..b6d87ff102460f75d2966c120aabdf1c9ea2adc1 100644 (file)
@@ -12,10 +12,8 @@ class opendaylight::params {
   $extra_features = []
   $odl_rest_port = '8080'
   $odl_bind_ip = '0.0.0.0'
-  $install_method = 'rpm'
   $rpm_repo = 'opendaylight-5-testing'
-  $tarball_url = ''
-  $unitfile_url = 'https://github.com/dfarrell07/opendaylight-systemd/archive/master/opendaylight-unitfile.tar.gz'
+  $deb_repo = 'ppa:odl-team/boron'
   $log_levels = {}
   $enable_ha = false
   $ha_node_ips = []
index 58fbdd7d9f2522b95f0e12ada61d011a12dae4a3..9e213906763d1ba1cf79122af915a21e50ddca88 100644 (file)
@@ -13,12 +13,12 @@ describe 'opendaylight class' do
     install_odl
 
     # Run checks specific to install type, via env var passed from Rakefile
-    if ENV['INSTALL_METHOD'] == 'tarball'
-      # Call specialized helper fn for tarball-type install validations
-      tarball_validations
-    else
+    if :osfamily == 'RedHat'
       # Call specialized helper fn for RPM-type install validations
       rpm_validations
+    elsif :osfamily == 'Debian'
+      # Call specialized helper fn for Deb-type install validations
+      deb_validations
     end
 
     # Use helper fn to run generic validations
diff --git a/spec/acceptance/nodesets/ubuntu-16-docker.yml b/spec/acceptance/nodesets/ubuntu-16-docker.yml
new file mode 100644 (file)
index 0000000..329e1ae
--- /dev/null
@@ -0,0 +1,14 @@
+HOSTS:
+  ubuntu-16-docker:
+    roles:
+      - master
+    platform: ubuntu-1604-x86_64
+    image: ubuntu:16.04
+    hypervisor: docker
+    docker_image_commands:
+      - 'apt-get install -y software-properties-common'
+    docker_cmd: '["/sbin/init"]'
+
+CONFIG:
+  log_level: verbose
+  type: foss
diff --git a/spec/acceptance/nodesets/ubuntu-16.yml b/spec/acceptance/nodesets/ubuntu-16.yml
new file mode 100644 (file)
index 0000000..de8b3ed
--- /dev/null
@@ -0,0 +1,12 @@
+---
+HOSTS:
+  ubuntu-16:
+    roles:
+      - master
+    platform: ubuntu-1604-x86_64
+    box:  puphpet/ubuntu1604-x64
+    box_url: https://atlas.hashicorp.com/puphpet/boxes/ubuntu1604-x64
+    hypervisor: vagrant
+CONFIG:
+  log_level: verbose
+  type: foss
index 9b99032d3df34f96f5688a8763097a8f6a132c2e..895f94d84033b2c84f30b4e48efad60d93e22b07 100644 (file)
@@ -129,37 +129,32 @@ describe 'opendaylight' do
     describe 'OS family Debian' do
       osfamily = 'Debian'
 
-      # All tests for Ubuntu 14.04
+      # All tests for Ubuntu 16.04
       describe 'Ubuntu' do
         operatingsystem = 'Ubuntu'
 
         # All tests for supported versions of Ubuntu
-        ['14.04'].each do |operatingsystemmajrelease|
-          context "#{operatingsystemmajrelease}" do
+        ['16.04'].each do |operatingsystemrelease|
+          context "#{operatingsystemrelease}" do
             let(:facts) {{
               :osfamily => osfamily,
               :operatingsystem => operatingsystem,
-              :operatingsystemmajrelease => operatingsystemmajrelease,
-              # TODO: Do more elegantly. Java mod uses codenames to ID version.
-              :lsbdistcodename => 'trusty',
-              :architecture => 'x86_64',
+              :operatingsystemrelease => operatingsystemrelease,
+              :lsbdistid => operatingsystem,
+              :lsbdistrelease => operatingsystemrelease,
+              :lsbdistcodename => 'xenial',
+              :puppetversion => '4.9.0',
               :path => ['/usr/local/bin', '/usr/bin', '/bin'],
             }}
 
-            # NB: Only tarball installs are supported for Debian family OSs
-            let(:params) {{
-              :install_method => 'tarball',
-            }}
-
             # Run shared tests applicable to all supported OSs
             # Note that this function is defined in spec_helper
             generic_tests
 
-            # Run test that specialize in checking tarball-based installs
-            # NB: Only testing defaults here, specialized tarball tests elsewhere
-            # Passing osfamily required to do upstart vs systemd (default) checks
+            # Run test that specialize in checking deb-based installs
+            # NB: Passing osfamily required to do upstart vs systemd (default) checks
             # Note that this function is defined in spec_helper
-            tarball_install_tests(osfamily: osfamily)
+            deb_install_tests(osfamily: osfamily)
 
             # Run test that specialize in checking Karaf feature installs
             # NB: Only testing defaults here, specialized Karaf tests elsewhere
@@ -184,16 +179,20 @@ describe 'opendaylight' do
         end
 
         # All tests for unsupported versions of Ubuntu
-        ['12.04', '15.10'].each do |operatingsystemmajrelease|
-          context "#{operatingsystemmajrelease}" do
+        ['12.04', '14.04', '15.10'].each do |operatingsystemrelease|
+          context "#{operatingsystemrelease}" do
             let(:facts) {{
               :osfamily => osfamily,
               :operatingsystem => operatingsystem,
-              :operatingsystemmajrelease => operatingsystemmajrelease,
+              :operatingsystemrelease => operatingsystemrelease,
+              :lsbdistid => operatingsystem,
+              :lsbdistrelease => operatingsystemrelease,
+              :lsbdistcodename => 'xenial',
+              :puppetversion => '4.9.0',
             }}
             # Run shared tests applicable to all unsupported OSs
             # Note that this function is defined in spec_helper
-            expected_msg = "Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}"
+            expected_msg = "Unsupported OS: #{operatingsystem} #{operatingsystemrelease}"
             unsupported_os_tests(expected_msg: expected_msg)
           end
         end
@@ -504,16 +503,17 @@ describe 'opendaylight' do
 
   # All install method tests
   describe 'install method tests' do
-    # Non-OS-type tests assume CentOS 7
-    #   See issue #43 for reasoning:
-    #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
-    osfamily = 'RedHat'
-    operatingsystem = 'CentOS'
-    operatingsystemrelease = '7.0'
-    operatingsystemmajrelease = '7'
 
     # All tests for RPM install method
     describe 'RPM' do
+      # Non-OS-type tests assume CentOS 7
+      #   See issue #43 for reasoning:
+      #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
+      osfamily = 'RedHat'
+      operatingsystem = 'CentOS'
+      operatingsystemrelease = '7.0'
+      operatingsystemmajrelease = '7'
+
       context 'installing default RPM' do
         let(:facts) {{
           :osfamily => osfamily,
@@ -521,10 +521,6 @@ describe 'opendaylight' do
           :operatingsystemmajrelease => operatingsystemmajrelease,
         }}
 
-        let(:params) {{
-          :install_method => 'rpm',
-        }}
-
         # Run shared tests applicable to all supported OSs
         # Note that this function is defined in spec_helper
         generic_tests
@@ -543,7 +539,6 @@ describe 'opendaylight' do
         }}
 
         let(:params) {{
-          :install_method => 'rpm',
           :rpm_repo => rpm_repo,
         }}
 
@@ -557,116 +552,66 @@ describe 'opendaylight' do
       end
     end
 
-    # All tests for tarball install method
-    describe 'tarball' do
-      describe 'using default tarball_url' do
-        context 'using default unitfile_url' do
-          let(:facts) {{
-            :osfamily => osfamily,
-            :operatingsystem => operatingsystem,
-            :operatingsystemrelease => operatingsystemrelease,
-            :operatingsystemmajrelease => operatingsystemmajrelease,
-            :architecture => 'x86_64',
-            :path => ['/usr/local/bin', '/usr/bin', '/bin'],
-          }}
-
-          let(:params) {{
-            :install_method => 'tarball',
-          }}
-
-          # Run shared tests applicable to all supported OSs
-          # Note that this function is defined in spec_helper
-          generic_tests
-
-          # Run test that specialize in checking tarball-based installs
-          # Note that this function is defined in spec_helper
-          tarball_install_tests
-        end
+    # All tests for Deb install method
+    describe 'Deb' do
+      osfamily = 'Debian'
+      operatingsystem = 'Ubuntu'
+      operatingsystemrelease = '16.04'
+      operatingsystemmajrelease = '16'
+      lsbdistcodename = 'xenial'
+      
+      context 'installing Deb' do
+        let(:facts) {{
+          :osfamily => osfamily,
+          :operatingsystem => operatingsystem,
+          :operatingsystemrelease => operatingsystemrelease,
+          :operatingsystemmajrelease => operatingsystemmajrelease,
+          :lsbdistid => operatingsystem,
+          :lsbdistrelease => operatingsystemrelease,
+          :lsbmajdistrelease => operatingsystemmajrelease,
+          :lsbdistcodename => lsbdistcodename,
+          :puppetversion => Puppet.version,
+        }}
 
-        context 'overriding default unitfile_url' do
-          # Doesn't matter if this is valid, just that it honors what we pass
-          unitfile_url = 'fake_unitfile'
-          let(:facts) {{
-            :osfamily => osfamily,
-            :operatingsystem => operatingsystem,
-            :operatingsystemrelease => operatingsystemrelease,
-            :operatingsystemmajrelease => operatingsystemmajrelease,
-            :architecture => 'x86_64',
-            :path => ['/usr/local/bin', '/usr/bin', '/bin'],
-          }}
-
-          let(:params) {{
-            :install_method => 'tarball',
-            :unitfile_url => unitfile_url,
-          }}
-
-          # Run shared tests applicable to all supported OSs
-          # Note that this function is defined in spec_helper
-          generic_tests
-
-          # Run test that specialize in checking tarball-based installs
-          # Note that this function is defined in spec_helper
-          tarball_install_tests(unitfile_url: unitfile_url)
-        end
+        # Run shared tests applicable to all supported OSs
+        # Note that this function is defined in spec_helper
+        generic_tests
+
+        # Run test that specialize in checking RPM-based installs
+        # Note that this function is defined in spec_helper
+        deb_install_tests
       end
 
-      describe 'overriding default tarball_url' do
-        # Doesn't matter if this is valid, just that it honors what we pass
-        tarball_url = 'fake_tarball'
-        context 'using default unitfile_url' do
-          unitfile_url = 'https://github.com/dfarrell07/opendaylight-systemd/archive/master/opendaylight-unitfile.tar.gz'
-          let(:facts) {{
-            :osfamily => osfamily,
-            :operatingsystem => operatingsystem,
-            :operatingsystemrelease => operatingsystemrelease,
-            :operatingsystemmajrelease => operatingsystemmajrelease,
-            :architecture => 'x86_64',
-            :path => ['/usr/local/bin', '/usr/bin', '/bin'],
-          }}
-
-          let(:params) {{
-            :install_method => 'tarball',
-            :tarball_url => tarball_url,
-          }}
-
-          # Run shared tests applicable to all supported OSs
-          # Note that this function is defined in spec_helper
-          generic_tests
-
-          # Run test that specialize in checking tarball-based installs
-          # Note that this function is defined in spec_helper
-          tarball_install_tests(tarball_url: tarball_url)
-        end
+      context 'installing Boron Deb' do
+        deb_repo = 'ppa:odl-team/boron'
+        let(:facts) {{
+          :osfamily => osfamily,
+          :operatingsystem => operatingsystem,
+          :operatingsystemrelease => operatingsystemrelease,
+          :operatingsystemmajrelease => operatingsystemmajrelease,
+          :lsbdistid => operatingsystem,
+          :lsbdistrelease => operatingsystemrelease,
+          :lsbmajdistrelease => operatingsystemmajrelease,
+          :lsbdistcodename => lsbdistcodename,
+          :puppetversion => Puppet.version,
+        }}
 
-        context 'overriding default unitfile_url' do
-          # Doesn't matter if this is valid, just that it honors what we pass
-          unitfile_url = 'fake_unitfile'
-          let(:facts) {{
-            :osfamily => osfamily,
-            :operatingsystem => operatingsystem,
-            :operatingsystemrelease => operatingsystemrelease,
-            :operatingsystemmajrelease => operatingsystemmajrelease,
-            :architecture => 'x86_64',
-            :path => ['/usr/local/bin', '/usr/bin', '/bin'],
-          }}
-
-          let(:params) {{
-            :install_method => 'tarball',
-            :tarball_url => tarball_url,
-            :unitfile_url => unitfile_url,
-          }}
-
-          # Run shared tests applicable to all supported OSs
-          # Note that this function is defined in spec_helper
-          generic_tests
-
-          # Run test that specialize in checking tarball-based installs
-          # Note that this function is defined in spec_helper
-          tarball_install_tests(tarball_url: tarball_url, unitfile_url: unitfile_url)
-        end
+        let(:params) {{
+          :deb_repo => deb_repo,
+        }}
+
+        # Run shared tests applicable to all supported OSs
+        # Note that this function is defined in spec_helper
+        generic_tests
+
+        # Run test that specialize in checking RPM-based installs
+        # Note that this function is defined in spec_helper
+        deb_install_tests(deb_repo: deb_repo)
       end
     end
+
   end
+
   # Security Group Tests
   describe 'security group tests' do
     # Non-OS-type tests assume CentOS 7
index 7b130b13acd861947a6fecbf75be1399bc9374aa..7bf984d30f385e9ab4ae5eae53c06f7cfaf60baf 100644 (file)
@@ -211,139 +211,6 @@ def enable_ha_tests(options = {})
   end
 end
 
-def tarball_install_tests(options = {})
-  # Extract params
-  # NB: These default values should be the same as ones in opendaylight::params
-  # TODO: Remove this possible source of bugs^^
-  tarball_url = options.fetch(:tarball_url, '')
-  unitfile_url = options.fetch(:unitfile_url, 'https://github.com/dfarrell07/opendaylight-systemd/archive/master/opendaylight-unitfile.tar.gz')
-  osfamily = options.fetch(:osfamily, 'RedHat')
-  rpm_repo = options.fetch(:rpm_repo, 'opendaylight-5-testing')
-
-  # Confirm presence of tarball-related resources
-  it { should contain_archive('opendaylight') }
-  it { should contain_class('java') }
-  it { should contain_file('/opt/opendaylight/') }
-  it { should contain_user('odl') }
-  it { should contain_group('odl') }
-
-  # Confirm relationships between tarball-related resources
-  it { should contain_archive('opendaylight').that_comes_before('File[/opt/opendaylight/]') }
-  it { should contain_archive('opendaylight').that_comes_before('User[odl]') }
-  it { should contain_file('/opt/opendaylight/').that_requires('Archive[opendaylight]') }
-  it { should contain_file('/opt/opendaylight/').that_requires('Group[odl]') }
-  it { should contain_file('/opt/opendaylight/').that_requires('User[odl]') }
-  it { should contain_user('odl').that_comes_before('File[/opt/opendaylight/]') }
-  it { should contain_user('odl').that_requires('Archive[opendaylight]') }
-  it { should contain_user('odl').that_requires('Group[odl]') }
-  it { should contain_group('odl').that_comes_before('File[/opt/opendaylight/]') }
-  it { should contain_group('odl').that_comes_before('User[odl]') }
-
-  # Confirm properties of tarball-related resources
-  # NB: These hashes don't work with Ruby 1.8.7, but we
-  #   don't support 1.8.7 so that's okay. See issue #36.
-  it {
-    should contain_archive('opendaylight').with(
-      'ensure'           => 'present',
-      'url'              => tarball_url,
-      'target'           => '/opt/opendaylight/',
-      'checksum'         => false,
-      'strip_components' => 1,
-      'timeout'          => 600,
-    )
-  }
-  it {
-    should contain_file('/opt/opendaylight/').with(
-      'ensure'  => 'directory',
-      'recurse' => true,
-      'owner'   => 'odl',
-      'group'   => 'odl',
-    )
-  }
-  it {
-    should contain_user('odl').with(
-      'name'       => 'odl',
-      'ensure'     => 'present',
-      'home'       => '/opt/opendaylight/',
-      'membership' => 'minimum',
-      'groups'     => 'odl',
-    )
-  }
-  it {
-    should contain_group('odl').with(
-      'name'       => 'odl',
-      'ensure'     => 'present',
-    )
-  }
-
-  # OS-specific validations
-  case osfamily
-  when 'RedHat'
-    # Validations specific to Red Hat family OSs (RHEL/CentOS/Fedora)
-    it { should contain_archive('opendaylight-systemd') }
-    it { should contain_file('/usr/lib/systemd/system/opendaylight.service') }
-    it { should contain_archive('opendaylight-systemd').that_comes_before('File[/usr/lib/systemd/system/opendaylight.service]') }
-    it { should contain_file('/usr/lib/systemd/system/opendaylight.service').that_requires('Archive[opendaylight-systemd]') }
-
-    # NB: These hashes don't work with Ruby 1.8.7, but we
-    #   don't support 1.8.7 so that's okay. See issue #36.
-    it {
-      should contain_package('java').with(
-        'name' => 'java-1.7.0-openjdk',
-      )
-    }
-    it {
-      should contain_archive('opendaylight-systemd').with(
-        'ensure'           => 'present',
-        'url'              => unitfile_url,
-        'target'           => '/usr/lib/systemd/system/',
-        'root_dir'         => 'opendaylight.service',
-        'checksum'         => false,
-        'strip_components' => 1,
-        'follow_redirects' => true,
-      )
-    }
-    it {
-      should contain_file('/usr/lib/systemd/system/opendaylight.service').with(
-        'ensure'  => 'file',
-        'owner'   => 'root',
-        'group'   => 'root',
-        'mode'    => '0644',
-      )
-    }
-  when 'Debian'
-    # Validations specific to Debain family OSs (Ubuntu)
-    it {
-      should contain_package('java').with(
-        'name' => 'openjdk-7-jdk',
-      )
-    }
-    it {
-      should contain_file('/etc/init/opendaylight.conf').with(
-        'ensure'  => 'file',
-        'owner'   => 'root',
-        'group'   => 'root',
-        'mode'    => '0644',
-      )
-    }
-    expected_msg = 'Debian has limited support, is less stable, less tested.'
-    it {
-      expect {
-        # This could be any check, most (all?) will raise warning
-        should contain_file('/etc/init/opendaylight.conf').to(
-          raise_warning(Puppet::Warning, /#{expected_msg}/)
-        )
-      }
-    }
-  else
-    fail("Unexpected osfamily #{osfamily}")
-  end
-
-  # Verify that there are no unexpected resources from RPM-type installs
-  it { should_not contain_yumrepo(rpm_repo) }
-  it { should_not contain_package('opendaylight') }
-end
-
 def rpm_install_tests(options = {})
   # Extract params
   rpm_repo = options.fetch(:rpm_repo, 'opendaylight-5-testing')
@@ -386,6 +253,26 @@ def rpm_install_tests(options = {})
   }
 end
 
+def deb_install_tests(options = {})
+  # Extract params
+  deb_repo = options.fetch(:deb_repo, 'ppa:odl-team/boron')
+
+  # Confirm the presence of Deb-related resources
+  it { should contain_apt__ppa(deb_repo) }
+  it { should contain_package('opendaylight') }
+
+  # Confirm relationships between Deb-related resources
+  it { should contain_package('opendaylight').that_requires("Apt::Ppa[#{deb_repo}]") }
+  it { should contain_apt__ppa(deb_repo).that_comes_before('Package[opendaylight]') }
+
+  # Confirm presence of Deb-related resources
+  it {
+    should contain_package('opendaylight').with(
+      'ensure'   => 'present',
+    )
+  }
+end
+
 # Shared tests for unsupported OSs
 def unsupported_os_tests(options = {})
   # Extract params
index 7f1d30dd0ea3146e6bbdd8bc1acf01a301ebe8f8..6b96e99f76ed0e14fa33a35e1cf0ededff12e37f 100644 (file)
@@ -7,6 +7,8 @@ unless ENV['BEAKER_provision'] == 'no'
     # Install Puppet
     if host.is_pe?
       install_pe
+    elsif host.name == "ubuntu-16-docker" || host.name == "ubuntu-16"
+      install_puppet_agent_on(host, puppet_collection: "pc1")
     else
       install_puppet
     end
@@ -28,10 +30,8 @@ RSpec.configure do |c|
     hosts.each do |host|
       # Install stdlib, a dependency of the odl mod
       on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0] }
-      # Install archive, a dependency of the odl mod use for tarball-type installs
-      on host, puppet('module', 'install', 'camptocamp-archive'), { :acceptable_exit_codes => [0] }
-      # Install Java Puppet mod, a dependency of the tarball install method
-      on host, puppet('module', 'install', 'puppetlabs-java'), { :acceptable_exit_codes => [0] }
+      # Install apt, a dependency of the deb install method
+      on host, puppet('module', 'install', 'puppetlabs-apt'), { :acceptable_exit_codes => [0] }
     end
   end
 end
@@ -50,8 +50,14 @@ def install_odl(options = {})
   # Changing the installed version of ODL via `puppet apply` is not supported
   # by puppet-odl, so it's not possible to vary these params in the same
   # Beaker test run. Do a different run passing different env vars.
-  install_method = ENV['INSTALL_METHOD']
   rpm_repo = ENV['RPM_REPO']
+  deb_repo = ENV['DEB_REPO']
+
+  if rpm_repo == ''
+    rpm_repo = 'none'
+  elsif deb_repo == ''
+    deb_repo = 'none'
+  end
 
   # NB: These param defaults should match the ones used by the opendaylight
   #   class, which are defined in opendaylight::params
@@ -70,8 +76,8 @@ def install_odl(options = {})
   it 'should work idempotently with no errors' do
     pp = <<-EOS
     class { 'opendaylight':
-      install_method => #{install_method},
-      rpm_repo => #{rpm_repo},
+      rpm_repo => '#{rpm_repo}',
+      deb_repo => '#{deb_repo}',
       default_features => #{default_features},
       extra_features => #{extra_features},
       odl_rest_port=> #{odl_rest_port},
@@ -107,10 +113,10 @@ def generic_validations()
   describe service('opendaylight') do
     it { should be_enabled }
     it { should be_enabled.with_level(3) }
-    it { should be_running }
+    it { should be_running.under('systemd') }
   end
 
-  # Creation handled by RPM, or Puppet during tarball installs
+  # Creation handled by RPM or Deb
   describe user('odl') do
     it { should exist }
     it { should belong_to_group 'odl' }
@@ -123,7 +129,7 @@ def generic_validations()
     it { should have_home_directory '/opt/opendaylight' }
   end
 
-  # Creation handled by RPM, or Puppet during tarball installs
+  # Creation handled by RPM or Deb
   describe group('odl') do
     it { should exist }
   end
@@ -175,21 +181,23 @@ def generic_validations()
     describe package('java-1.8.0-openjdk') do
       it { should be_installed }
     end
-  elsif ['ubuntu-1404', 'ubuntu-1404-docker'].include? ENV['RS_SET']
-    # Ubuntu-specific validations
 
-    # Verify ODL Upstart config file
-    describe file('/etc/init/opendaylight.conf') do
+  # Ubuntu 16.04 specific validation  
+  elsif ['ubuntu-16', 'ubuntu-16-docker'].include? ENV['RS_SET']
+
+    # Verify ODL systemd .service file
+    describe file('/lib/systemd/system/opendaylight.service') do
       it { should be_file }
       it { should be_owned_by 'root' }
       it { should be_grouped_into 'root' }
       it { should be_mode '644' }
     end
 
-    # Java 7 should be installed
-    describe package('openjdk-7-jdk') do
+    # Java 8 should be installed
+    describe package('openjdk-8-jre-headless') do
       it { should be_installed }
     end
+
   else
     fail("Unexpected RS_SET (host OS): #{ENV['RS_SET']}")
   end
@@ -308,19 +316,17 @@ def rpm_validations()
   end
 end
 
-# Shared function that handles validations specific to tarball-type installs
-def tarball_validations()
-  rpm_repo = ENV['RPM_REPO']
-
-  describe package('opendaylight') do
-    it { should_not be_installed }
+# Shared function that handles validations specific to Deb-type installs
+def deb_validations()
+  deb_repo = ENV['DEB_REPO']
+  # Check ppa
+  # Docs: http://serverspec.org/resource_types.html#ppa
+  describe ppa(deb_repo) do
+    it { should exist }
+    it { should be_enabled }
   end
 
-  # Repo checks break (not fail) when yum doesn't make sense (Ubuntu)
-  if ['centos-7', 'fedora-22', 'fedora-23', 'fedora-23-docker'].include? ENV['RS_SET']
-    describe yumrepo(rpm_repo) do
-      it { should_not exist }
-      it { should_not be_enabled }
-    end
+  describe package('opendaylight') do
+    it { should be_installed }
   end
 end