1 # == Class opendaylight::config
3 # This class handles ODL config changes.
4 # It's called from the opendaylight class.
6 class opendaylight::config {
7 # Configuration of Karaf features to install
8 file { 'org.apache.karaf.features.cfg':
10 path => '/opt/opendaylight/etc/org.apache.karaf.features.cfg',
11 # Set user:group owners
15 $features_csv = join($opendaylight::features, ',')
16 file_line { 'featuresBoot':
17 path => '/opt/opendaylight/etc/org.apache.karaf.features.cfg',
18 line => "featuresBoot=${features_csv}",
19 match => '^featuresBoot=.*$',
22 # Configuration of ODL NB REST port to listen on
25 path => '/opt/opendaylight/etc/jetty.xml',
26 # Set user:group owners
29 # Use a template to populate the content
30 content => template('opendaylight/jetty.xml.erb'),
33 # Set any custom log levels
34 $opendaylight::log_levels.each |$log_name, $logging_level| {
35 file_line {"logger-${log_name}":
37 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
38 line => "log4j.logger.${log_name}=${logging_level}"
42 # Set maximum ODL log file size
43 file_line { 'logmaxsize':
45 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
46 line => "log4j.appender.out.maxFileSize=${::opendaylight::log_max_size}",
47 match => '^log4j.appender.out.maxFileSize.*$'
50 # Set maximum number of ODL log file rollovers to preserve
51 file_line { 'logmaxrollover':
53 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
54 line => "log4j.appender.out.maxBackupIndex=${::opendaylight::log_max_rollover}",
55 match => '^log4j.appender.out.maxBackupIndex.*$'
58 # Configure ODL HA if enabled
59 $ha_node_count = count($::opendaylight::ha_node_ips)
60 if $::opendaylight::enable_ha {
61 if $ha_node_count >= 2 {
62 # Configure ODL OSVDB Clustering
63 $cluster_config_dir = '/opt/opendaylight/configuration/initial'
65 file { $cluster_config_dir:
74 path => "${cluster_config_dir}/akka.conf",
77 content => template('opendaylight/akka.conf.erb'),
78 require => File[$cluster_config_dir]
83 path => "${cluster_config_dir}/modules.conf",
86 content => template('opendaylight/modules.conf.erb'),
87 require => File[$cluster_config_dir]
90 file {'module-shards.conf':
92 path => "${cluster_config_dir}/module-shards.conf",
95 content => template('opendaylight/module-shards.conf.erb'),
96 require => File[$cluster_config_dir]
100 fail("Number of HA nodes less than 2: ${ha_node_count} and HA Enabled")
104 if ('odl-netvirt-openstack' in $opendaylight::features or 'odl-netvirt-sfc' in $opendaylight::features) {
105 # Configure ACL security group
106 # Requires at least CentOS 7.3 for RHEL/CentOS systems
107 if $opendaylight::security_group_mode == 'stateful' {
108 if defined('$opendaylight::stateful_unsupported') and $opendaylight::stateful_unsupported {
109 warning("Stateful is unsupported in ${::operatingsystemrelease} setting to 'learn'")
112 $sg_mode = 'stateful'
115 $sg_mode = $opendaylight::security_group_mode
119 '/opt/opendaylight/etc/opendaylight',
120 '/opt/opendaylight/etc/opendaylight/datastore',
121 '/opt/opendaylight/etc/opendaylight/datastore/initial',
122 '/opt/opendaylight/etc/opendaylight/datastore/initial/config',
125 file { $odl_datastore:
131 -> file { 'netvirt-aclservice-config.xml':
133 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml',
136 content => template('opendaylight/netvirt-aclservice-config.xml.erb'),
140 file { 'netvirt-natservice-config.xml':
142 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml',
145 content => template('opendaylight/netvirt-natservice-config.xml.erb'),
146 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
151 if ('odl-netvirt-sfc' in $opendaylight::features) {
152 file { 'netvirt-elanmanager-config.xml':
154 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml',
157 source => 'puppet:///modules/opendaylight/netvirt-elanmanager-config.xml',
158 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
161 file { 'genius-itm-config.xml':
163 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml',
166 source => 'puppet:///modules/opendaylight/genius-itm-config.xml',
167 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
171 #configure VPP routing node
172 if ! empty($::opendaylight::vpp_routing_node) {
173 file { 'org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg':
175 path => '/opt/opendaylight/etc/org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg',
179 file_line { 'routing-node':
180 path => '/opt/opendaylight/etc/org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg',
181 line => "routing-node=${::opendaylight::vpp_routing_node}",
182 match => '^routing-node=.*$',
186 # Configure username/password
187 odl_user { $::opendaylight::username:
188 password => $::opendaylight::password,
189 before => Service['opendaylight'],