3 # Deploy N1KV VEM on compute and network nodes.
4 # Support exists and tested for RedHat.
5 # (For Ubuntu/Debian platforms few changes and testing pending.)
9 # (required) N1KV VSM(Virtual Supervisor Module) VM's IP.
10 # Defaults to 127.0.0.1
12 # [*n1kv_vsm_domainid*]
13 # (required) N1KV VSM DomainID.
17 # (required) Management Interface of node where VEM will be installed.
21 # (optional) Uplink Interfaces that will be managed by VEM. The uplink
22 # port-profile that configures these interfaces should also be specified.
24 # $uplink_profile = { 'eth1' => 'profile1',
25 # 'eth2' => 'profile2'
30 # (optional) Virtual tunnel interface configuration.
31 # Eg:VxLAN tunnel end-points.
33 # $vtep_config = { 'vtep1' => { 'profile' => 'virtprof1',
36 # 'vtep2' => { 'profile' => 'virtprof2',
37 # 'ipmode' => 'static',
38 # 'ipaddress' => '192.168.1.1',
39 # 'netmask' => '255.255.255.0'
45 # (optional). Specify the type of node: 'compute' (or) 'network'.
46 # Defaults to 'compute'
48 # All the above parameter values will be used in the config file: n1kv.conf
50 # [*vteps_in_same_subnet*]
52 # The VXLAN tunnel interfaces created on VEM can belong to same IP-subnet.
53 # In such case, set this parameter to true. This results in below
54 # 'sysctl:ipv4' values to be modified.
55 # rp_filter (reverse path filtering) set to 2(Loose).Default is 1(Strict)
56 # arp_ignore (arp reply mode) set to 1:reply only if target ip matches
57 # that of incoming interface. Default is 0
58 # arp_announce (arp announce mode) set to 1. Default is 0
59 # Please refer Linux Documentation for detailed description
60 # http://lxr.free-electrons.com/source/Documentation/networking/ip-sysctl.txt
62 # If the tunnel interfaces are not in same subnet set this parameter to false.
63 # Note that setting to false causes no change in the sysctl settings and does
64 # not revert the changes made if it was originally set to true on a previous
71 # n1kv_source ==> VEM package location. One of below
72 # A)URL of yum repository that hosts VEM package.
73 # B)VEM RPM/DPKG file name, If present locally in 'files' folder
74 # C)If not specified, assumes that VEM image is available in
75 # default enabled repositories.
79 # (optional). Specify VEM package version to be installed.
80 # Not applicable if 'n1kv_source' is a file. (Option-B above)
81 # Defaults to 'present'
84 # (optional) Ensure state for dependent packages: Openvswitch/libnl.
85 # Defaults to 'present'.
88 # (optional) Enable state for service. Defaults to 'true'.
91 # (optional) Whether to start/stop the service
95 # (optional) PortDB (ovs|vem)
99 # (optional) Handle broadcast floods and unknown pkts in fastpath(KLM)
100 # Defaults to disable
102 class neutron::agents::n1kv_vem (
103 $n1kv_vsm_ip = '127.0.0.1',
104 $n1kv_vsm_domain_id = 1000,
105 $host_mgmt_intf = 'eth1',
106 $uplink_profile = {},
108 $node_type = 'compute',
109 $vteps_in_same_subnet = false,
111 $n1kv_version = 'present',
112 $package_ensure = 'present',
114 $manage_service = true,
116 $fastpath_flood = 'disable'
119 include neutron::params
122 Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }
124 if($::osfamily != 'Redhat') {
125 #current support exists for Redhat family.
126 #Support for Debian will be added soon.
127 fail("Unsupported osfamily ${::osfamily}")
130 #Check source of n1kv-vem image:yum-repo (or) local file in 'files' directory
131 if $n1kv_source != '' {
132 if ($n1kv_source =~ /^http/) or ($n1kv_source =~ /^ftp/) {
133 $vemimage_uri = 'repo'
135 $vemimage_uri = 'file'
136 $vemtgtimg = "/var/n1kv/${n1kv_source}"
139 $vemimage_uri = 'unspec'
144 ensure => $package_ensure,
145 name => $::neutron::params::libnl_package
161 #specify template corresponding to 'n1kv.conf'
162 file {'/etc/n1kv/n1kv.conf':
167 content => template('neutron/n1kv.conf.erb'),
168 require => File['/etc/n1kv'],
171 if $vemimage_uri == 'file' {
172 #specify location on target-host where image file will be downloaded to.
173 #Later vem package: 'nexus1000v' will be installed from this file.
178 source => "puppet:///modules/neutron/${n1kv_source}",
179 require => File['/var/n1kv'],
181 package {'nexus1000v':
182 ensure => $n1kv_version,
183 provider => $::neutron::params::package_provider,
184 source => $vemtgtimg,
185 require => File[$vemtgtimg]
188 if $vemimage_uri == 'repo' {
189 #vem package: 'nexus1000v' will be downloaded and installed
191 yumrepo { 'cisco-vem-repo':
192 baseurl => $n1kv_source,
193 descr => 'Repo for VEM Image',
196 gpgkey => "${n1kv_source}/RPM-GPG-KEY"
200 package {'nexus1000v':
201 ensure => $package_ensure
207 $service_ensure = 'running'
209 $service_ensure = 'stopped'
213 service { 'nexus1000v':
214 ensure => $service_ensure,
217 #Upon config change in 'n1kv.conf' execute below 'vemcmd reread config'.
218 #No need to restart service.
219 exec { 'vemcmd reread config':
220 subscribe => File['/etc/n1kv/n1kv.conf'],
222 require => Service['nexus1000v']
225 if $vteps_in_same_subnet == true {
226 $my_sysctl_settings = {
227 'net.ipv4.conf.default.rp_filter' => { value => 2 },
228 'net.ipv4.conf.all.rp_filter' => { value => 2 },
229 'net.ipv4.conf.default.arp_ignore' => { value => 1 },
230 'net.ipv4.conf.all.arp_ignore' => { value => 1 },
231 'net.ipv4.conf.all.arp_announce' => { value => 2 },
232 'net.ipv4.conf.default.arp_announce' => { value => 2 },
234 create_resources(sysctl::value,$my_sysctl_settings)
237 Package['libnl'] -> Package['nexus1000v']
238 Service['openvswitch'] ~> Package['nexus1000v']
239 File['/etc/n1kv/n1kv.conf'] -> Package['nexus1000v']
240 Package['nexus1000v'] ~> Service['nexus1000v']