563291d7107768c6e8e4e00944c74b5b78511f87
[integration/packaging/puppet-opendaylight.git] / manifests / init.pp
1 # == Class: opendaylight
2 #
3 # OpenDaylight SDN Controller
4 #
5 # === Parameters
6 # [*default_features*]
7 #   Features that should normally be installed by default, but can be
8 #   overridden.
9 # [*extra_features*]
10 #   List of features to install in addition to the default ones.
11 # [*odl_rest_port *]
12 #   Port for ODL northbound REST interface to listen on.
13 # [*odl_bind_ip *]
14 #   IP for ODL northbound REST interface to bind to.
15 # [*rpm_repo*]
16 #   OpenDaylight CentOS CBS repo to install RPM from (opendaylight-4-testing,
17 #   opendaylight-40-release, ...).
18 # [*deb_repo*]
19 #   OpenDaylight Launchpad PPA repo to install .deb from (ppa:odl-team/boron,
20 #   ppa:odl-team/carbon, ...).
21 # [*log_levels*]
22 #   Custom OpenDaylight logger verbosity configuration (TRACE, DEBUG, INFO, WARN, ERROR).
23 # [*enable_ha*]
24 #   Enable or disable ODL OVSDB HA Clustering. Valid: true or false.
25 #   Default: false.
26 # [*ha_node_ips*]
27 #   Array of IPs for each node in the HA cluster.
28 # [*ha_node_index*]
29 #   Index of ha_node_ips for this node.
30 # [*security_group_mode*]
31 #   Sets the mode to use for security groups (stateful, learn, stateless, transparent)
32 # [*vpp_routing_node*]
33 #   Sets routing node for VPP deployments. Defaults to ''.
34 # [*java_opts*]
35 #   Sets Java options for ODL in a string format. Defaults to '-Djava.net.preferIPv4Stack=true'.
36 #
37 class opendaylight (
38   $default_features    = $::opendaylight::params::default_features,
39   $extra_features      = $::opendaylight::params::extra_features,
40   $odl_rest_port       = $::opendaylight::params::odl_rest_port,
41   $odl_bind_ip         = $::opendaylight::params::odl_bind_ip,
42   $rpm_repo            = $::opendaylight::params::rpm_repo,
43   $deb_repo            = $::opendaylight::params::deb_repo,
44   $log_levels          = $::opendaylight::params::log_levels,
45   $enable_ha           = $::opendaylight::params::enable_ha,
46   $ha_node_ips         = $::opendaylight::params::ha_node_ips,
47   $ha_node_index       = $::opendaylight::params::ha_node_index,
48   $security_group_mode = $::opendaylight::params::security_group_mode,
49   $vpp_routing_node    = $::opendaylight::params::vpp_routing_node,
50   $java_opts           = $::opendaylight::params::java_opts,
51 ) inherits ::opendaylight::params {
52
53   # Validate OS family
54   case $::osfamily {
55     'RedHat': {}
56     'Debian': {
57         warning('Debian has limited support, is less stable, less tested.')
58     }
59     default: {
60         fail("Unsupported OS family: ${::osfamily}")
61     }
62   }
63
64   # Validate OS
65   case $::operatingsystem {
66     centos, redhat: {
67       if $::operatingsystemmajrelease != '7' {
68         # RHEL/CentOS versions < 7 not supported as they lack systemd
69         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
70       } elsif defined('$::operatingsystemrelease') {
71           if (versioncmp($::operatingsystemrelease, '7.3') < 0) {
72             # Versions < 7.3 do not support stateful security groups
73             $stateful_unsupported = true
74           }
75         }
76     }
77     fedora: {
78       # Fedora distros < 22 are EOL as of 2015-12-01
79       # https://fedoraproject.org/wiki/End_of_life
80       if $::operatingsystemmajrelease < '22' {
81         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
82       }
83     }
84     ubuntu: {
85       if $::operatingsystemrelease < '16.04' {
86         # Only tested on 16.04
87         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemrelease}")
88       }
89     }
90     default: {
91       fail("Unsupported OS: ${::operatingsystem}")
92     }
93   }
94   # Build full list of features to install
95   $features = union($default_features, $extra_features)
96
97   class { '::opendaylight::install': } ->
98   class { '::opendaylight::config': } ~>
99   class { '::opendaylight::service': } ->
100   Class['::opendaylight']
101 }