4a23a893f8bd88a570dc10aa67f913324c5d5f56
[ovsnfv.git] / fuel-plugin-ovsnfv / deployment_scripts / puppet / modules / ovsdpdk / manifests / postinstall_ovs_dpdk.pp
1 # == Class ovsdpdk::postinstall_ovs_dpdk
2 #
3 # Postinstall configuration of ovs-dpdk service
4 #
5 class ovsdpdk::postinstall_ovs_dpdk (
6   $plugin_dir               = $::ovsdpdk::params::plugin_dir,
7   $nova_conf                = $::ovsdpdk::params::nova_conf,
8   $openvswitch_service_name = $::ovsdpdk::params::openvswitch_service_name,
9   $ml2_ovs_conf             = $::ovsdpdk::params::ml2_ovs_conf,
10   $neutron_l3_conf          = $::ovsdpdk::params::neutron_l3_conf,
11   $openvswitch_agent        = $::ovsdpdk::params::openvswitch_agent,
12 ) inherits ovsdpdk {
13
14   require ovsdpdk::install_ovs_dpdk
15
16   package {'crudini': ensure => installed }
17
18   if $compute == 'True' {
19           # adapt configuration files
20           exec {'adapt_nova_conf':
21             command => "${plugin_dir}/files/set_vcpu_pin.sh ${nova_conf}",
22             path    => ['/usr/bin','/bin'],
23             user    => root,
24             onlyif  => "test -f ${nova_conf}",
25             require => Package['crudini'],
26           }
27
28           exec {'adapt_ml2_conf':
29             command => "sudo crudini --set ${ml2_ovs_conf} ovs datapath_type ${ovs_datapath_type}",
30             path    => ['/usr/bin','/bin'],
31             user    => root,
32             onlyif  => "test -f ${ml2_ovs_conf}",
33             require => Package['crudini'],
34           }
35
36           exec {'adapt_neutron_l3':
37             command => "sudo crudini --set ${neutron_l3_conf} DEFAULT external_network_bridge br-ex",
38             path    => ['/usr/bin','/bin'],
39             user    => root,
40             onlyif  => "test -f ${neutron_l3_conf}",
41             require => Package['crudini'],
42           }
43
44
45           service {"${openvswitch_service_name}": ensure => 'running' }
46
47           # restart OVS to synchronize ovsdb-server with ovs-vswitchd needed
48           # due to several new --no-wait entries
49           exec {'restart_ovs':
50             command => "/usr/sbin/service ${openvswitch_service_name} restart",
51             user    => root,
52             require => Service["${openvswitch_service_name}"],
53           }
54
55           exec { "${plugin_dir}/files/configure_bridges.sh ${ovs_datapath_type}":
56         user    => root,
57         require => Exec['restart_ovs'],
58       }
59   }
60
61   if $controller == 'True' {
62     service {'neutron-server':
63        ensure => 'running',
64     }
65   }
66
67   if $compute == 'True' {
68           service {"${openvswitch_agent}":
69             ensure  => 'running',
70             require => [ Exec['restart_ovs'], Service["${openvswitch_service_name}"] ],
71           }
72   }
73
74 }