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 and IP to listen on
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}",
29 "set Call[1]/Arg/New/Set[#attribute[name='host']]/#text[1] ${opendaylight::odl_bind_ip}",
30 "rm Call[1]/Arg/New/Set[#attribute[name='host']]/Property",
31 "set Call[2]/Arg/New/Set[#attribute[name='host']]/#text[1] ${opendaylight::odl_bind_ip}",
32 "rm Call[2]/Arg/New/Set[#attribute[name='host']]/Property"]
35 # Set any custom log levels
36 $opendaylight::log_levels.each |$log_name, $logging_level| {
37 file_line {"logger-${log_name}":
39 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
40 line => "log4j.logger.${log_name}=${logging_level}"
44 # Set maximum ODL log file size
45 file_line { 'logmaxsize':
47 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
48 line => "log4j.appender.out.maxFileSize=${::opendaylight::log_max_size}",
49 match => '^log4j.appender.out.maxFileSize.*$'
52 # Set maximum number of ODL log file rollovers to preserve
53 file_line { 'logmaxrollover':
55 path => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
56 line => "log4j.appender.out.maxBackupIndex=${::opendaylight::log_max_rollover}",
57 match => '^log4j.appender.out.maxBackupIndex.*$'
60 # Configure ODL HA if enabled
61 $ha_node_count = count($::opendaylight::ha_node_ips)
62 if $::opendaylight::enable_ha {
63 if $ha_node_count >= 2 {
64 # Configure ODL OSVDB Clustering
65 $cluster_config_dir = '/opt/opendaylight/configuration/initial'
67 file { $cluster_config_dir:
76 path => "${cluster_config_dir}/akka.conf",
79 content => template('opendaylight/akka.conf.erb'),
80 require => File[$cluster_config_dir]
85 path => "${cluster_config_dir}/modules.conf",
88 content => template('opendaylight/modules.conf.erb'),
89 require => File[$cluster_config_dir]
92 file {'module-shards.conf':
94 path => "${cluster_config_dir}/module-shards.conf",
97 content => template('opendaylight/module-shards.conf.erb'),
98 require => File[$cluster_config_dir]
102 fail("Number of HA nodes less than 2: ${ha_node_count} and HA Enabled")
106 if ('odl-netvirt-openstack' in $opendaylight::features or 'odl-netvirt-sfc' in $opendaylight::features) {
107 # Configure ACL security group
108 # Requires at least CentOS 7.3 for RHEL/CentOS systems
109 if $opendaylight::security_group_mode == 'stateful' {
110 if defined('$opendaylight::stateful_unsupported') and $opendaylight::stateful_unsupported {
111 warning("Stateful is unsupported in ${::operatingsystemrelease} setting to 'learn'")
114 $sg_mode = 'stateful'
117 $sg_mode = $opendaylight::security_group_mode
121 '/opt/opendaylight/etc/opendaylight',
122 '/opt/opendaylight/etc/opendaylight/datastore',
123 '/opt/opendaylight/etc/opendaylight/datastore/initial',
124 '/opt/opendaylight/etc/opendaylight/datastore/initial/config',
127 file { $odl_datastore:
133 -> file { 'netvirt-aclservice-config.xml':
135 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml',
138 content => template('opendaylight/netvirt-aclservice-config.xml.erb'),
142 file { 'netvirt-natservice-config.xml':
144 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml',
147 content => template('opendaylight/netvirt-natservice-config.xml.erb'),
148 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
153 if ('odl-netvirt-sfc' in $opendaylight::features) {
154 file { 'netvirt-elanmanager-config.xml':
156 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml',
159 source => 'puppet:///modules/opendaylight/netvirt-elanmanager-config.xml',
160 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
163 file { 'genius-itm-config.xml':
165 path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml',
168 source => 'puppet:///modules/opendaylight/genius-itm-config.xml',
169 require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
173 #configure VPP routing node
174 if ! empty($::opendaylight::vpp_routing_node) {
175 file { 'org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg':
177 path => '/opt/opendaylight/etc/org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg',
181 file_line { 'routing-node':
182 path => '/opt/opendaylight/etc/org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg',
183 line => "routing-node=${::opendaylight::vpp_routing_node}",
184 match => '^routing-node=.*$',
188 # Configure username/password
189 odl_user { $::opendaylight::username:
190 password => $::opendaylight::password,
191 before => Service['opendaylight'],