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
23 augeas {'ODL REST Port':
24 incl => '/opt/opendaylight/etc/jetty.xml',
25 context => '/files/opt/opendaylight/etc/jetty.xml/Configure',
28 "set Call[2]/Arg/New/Set[#attribute[name='port']]/Property/#attribute/default ${opendaylight::odl_rest_port}"]
31 if $opendaylight::odl_bind_ip != '0.0.0.0' {
32 # Configuration of ODL NB REST IP to listen on
33 augeas { 'ODL REST IP':
34 incl => '/opt/opendaylight/etc/jetty.xml',
35 context => '/files/opt/opendaylight/etc/jetty.xml/Configure',
38 "set Call[1]/Arg/New/Set[#attribute[name='host']]/Property/#attribute/default ${opendaylight::odl_bind_ip}",
39 "set Call[2]/Arg/New/Set[#attribute[name='host']]/Property/#attribute/default ${opendaylight::odl_bind_ip}"]
42 file { 'org.ops4j.pax.web.cfg':
44 path => '/opt/opendaylight/etc/org.ops4j.pax.web.cfg',
45 # Set user:group owners
49 -> file_line { 'org.ops4j.pax.web.cfg':
51 path => '/opt/opendaylight/etc/org.ops4j.pax.web.cfg',
52 line => "org.ops4j.pax.web.listening.addresses = ${opendaylight::odl_bind_ip}"
56 # Set any custom log levels
57 $opendaylight::log_levels.each |$log_name, $logging_level| {
58 file_line {"logger-${log_name}":
60 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
61 line => "log4j.logger.${log_name}=${logging_level}"
65 # Set maximum ODL log file size
66 file_line { 'logmaxsize':
68 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
69 line => "log4j.appender.out.maxFileSize=${::opendaylight::log_max_size}",
70 match => '^log4j.appender.out.maxFileSize.*$'
73 # Set maximum number of ODL log file rollovers to preserve
74 file_line { 'logmaxrollover':
76 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
77 line => "log4j.appender.out.maxBackupIndex=${::opendaylight::log_max_rollover}",
78 match => '^log4j.appender.out.maxBackupIndex.*$'
81 # Configure ODL HA if enabled
82 $ha_node_count = count($::opendaylight::ha_node_ips)
83 if $::opendaylight::enable_ha {
84 if $ha_node_count >= 2 {
85 # Configure ODL OSVDB Clustering
86 $cluster_config_dir = '/opt/opendaylight/configuration/initial'
88 file { $cluster_config_dir:
97 path => "${cluster_config_dir}/akka.conf",
100 content => template('opendaylight/akka.conf.erb'),
101 require => File[$cluster_config_dir]
104 file {'modules.conf':
106 path => "${cluster_config_dir}/modules.conf",
109 content => template('opendaylight/modules.conf.erb'),
110 require => File[$cluster_config_dir]
113 file {'module-shards.conf':
115 path => "${cluster_config_dir}/module-shards.conf",
118 content => template('opendaylight/module-shards.conf.erb'),
119 require => File[$cluster_config_dir]
123 fail("Number of HA nodes less than 2: ${ha_node_count} and HA Enabled")
127 if ('odl-netvirt-openstack' in $opendaylight::features or 'odl-netvirt-sfc' in $opendaylight::features) {
128 # Configure ACL security group
129 # Requires at least CentOS 7.3 for RHEL/CentOS systems
130 if $opendaylight::security_group_mode == 'stateful' {
131 if defined('$opendaylight::stateful_unsupported') and $opendaylight::stateful_unsupported {
132 warning("Stateful is unsupported in ${::operatingsystemrelease} setting to 'learn'")
135 $sg_mode = 'stateful'
138 $sg_mode = $opendaylight::security_group_mode
142 '/opt/opendaylight/etc/opendaylight',
143 '/opt/opendaylight/etc/opendaylight/datastore',
144 '/opt/opendaylight/etc/opendaylight/datastore/initial',
145 '/opt/opendaylight/etc/opendaylight/datastore/initial/config',
148 file { $odl_datastore:
154 -> file { 'netvirt-aclservice-config.xml':
156 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml',
159 content => template('opendaylight/netvirt-aclservice-config.xml.erb'),
163 file { 'netvirt-natservice-config.xml':
165 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml',
168 content => template('opendaylight/netvirt-natservice-config.xml.erb'),
169 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
174 if ('odl-netvirt-sfc' in $opendaylight::features) {
175 file { 'netvirt-elanmanager-config.xml':
177 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml',
180 source => 'puppet:///modules/opendaylight/netvirt-elanmanager-config.xml',
181 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
184 file { 'genius-itm-config.xml':
186 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml',
189 source => 'puppet:///modules/opendaylight/genius-itm-config.xml',
190 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
194 #configure VPP routing node
195 if ! empty($::opendaylight::vpp_routing_node) {
196 file { 'org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg':
198 path => '/opt/opendaylight/etc/org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg',
202 file_line { 'routing-node':
203 path => '/opt/opendaylight/etc/org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg',
204 line => "routing-node=${::opendaylight::vpp_routing_node}",
205 match => '^routing-node=.*$',
209 # Configure username/password
210 odl_user { $::opendaylight::username:
211 password => $::opendaylight::password,
212 before => Service['opendaylight'],