try again, with puppetforge modules, correctly included now
[mirror/dsa-puppet.git] / 3rdparty / modules / neutron / lib / puppet / type / neutron_router.rb
1 Puppet::Type.newtype(:neutron_router) do
2
3   ensurable
4
5   newparam(:name, :namevar => true) do
6     desc 'Symbolic name for the router'
7     newvalues(/.*/)
8   end
9
10   newproperty(:id) do
11     desc 'The unique id of the router'
12     validate do |v|
13       raise(Puppet::Error, 'This is a read only property')
14     end
15   end
16
17   newproperty(:admin_state_up) do
18     desc 'The administrative status of the router'
19     newvalues(/(t|T)rue/, /(f|F)alse/)
20     munge do |v|
21       v.to_s.capitalize
22     end
23   end
24
25   newproperty(:external_gateway_info) do
26     desc <<-EOT
27       External network that this router connects to for gateway services
28       (e.g., NAT).
29     EOT
30     validate do |v|
31       raise(Puppet::Error, 'This is a read only property')
32     end
33   end
34
35   newproperty(:gateway_network_name) do
36     desc <<-EOT
37       The name of the external network that this router connects to
38       for gateway services (e.g. NAT).
39     EOT
40   end
41
42   newproperty(:gateway_network_id) do
43     desc <<-EOT
44       The uuid of the external network that this router connects to
45       for gateway services (e.g. NAT).
46     EOT
47     validate do |v|
48       raise(Puppet::Error, 'This is a read only property')
49     end
50   end
51
52   newproperty(:status) do
53     desc 'Whether the router is currently operational or not.'
54     validate do |v|
55       raise(Puppet::Error, 'This is a read only property')
56     end
57   end
58
59   newparam(:tenant_name) do
60     desc 'The name of the tenant which will own the router.'
61   end
62
63   newproperty(:tenant_id) do
64     desc 'A uuid identifying the tenant which will own the router.'
65   end
66
67   autorequire(:service) do
68     ['neutron-server']
69   end
70
71   autorequire(:keystone_tenant) do
72     [self[:tenant_name]] if self[:tenant_name]
73   end
74
75   autorequire(:neutron_network) do
76     [self[:gateway_network_name]] if self[:gateway_network_name]
77   end
78
79   validate do
80     if self[:ensure] != :present
81       return
82     end
83     if self[:tenant_id] && self[:tenant_name]
84       raise(Puppet::Error, <<-EOT
85 Please provide a value for only one of tenant_name and tenant_id.
86 EOT
87             )
88     end
89   end
90
91 end