1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
Puppet::Type.newtype(:neutron_router) do
ensurable
newparam(:name, :namevar => true) do
desc 'Symbolic name for the router'
newvalues(/.*/)
end
newproperty(:id) do
desc 'The unique id of the router'
validate do |v|
raise(Puppet::Error, 'This is a read only property')
end
end
newproperty(:admin_state_up) do
desc 'The administrative status of the router'
newvalues(/(t|T)rue/, /(f|F)alse/)
munge do |v|
v.to_s.capitalize
end
end
newproperty(:external_gateway_info) do
desc <<-EOT
External network that this router connects to for gateway services
(e.g., NAT).
EOT
validate do |v|
raise(Puppet::Error, 'This is a read only property')
end
end
newproperty(:gateway_network_name) do
desc <<-EOT
The name of the external network that this router connects to
for gateway services (e.g. NAT).
EOT
end
newproperty(:gateway_network_id) do
desc <<-EOT
The uuid of the external network that this router connects to
for gateway services (e.g. NAT).
EOT
validate do |v|
raise(Puppet::Error, 'This is a read only property')
end
end
newproperty(:status) do
desc 'Whether the router is currently operational or not.'
validate do |v|
raise(Puppet::Error, 'This is a read only property')
end
end
newparam(:project_name) do
desc 'The name of the project which will own the router.'
end
newproperty(:project_id) do
desc 'A uuid identifying the project which will own the router.'
end
autorequire(:anchor) do
['neutron::service::end']
end
autorequire(:keystone_tenant) do
[self[:project_name]] if self[:project_name]
end
autorequire(:neutron_network) do
[self[:gateway_network_name]] if self[:gateway_network_name]
end
newproperty(:distributed) do
desc 'Is router distributed or not, default depends on DVR state.'
newvalues(/(t|T)rue/, /(f|F)alse/)
munge do |v|
v.to_s.capitalize
end
end
newproperty(:ha) do
desc 'Is router of HA type or not, default depends on L3 HA state.'
newvalues(/(t|T)rue/, /(f|F)alse/)
munge do |v|
v.to_s.capitalize
end
end
newproperty(:availability_zone_hint) do
desc 'The availability zone hint to provide the scheduler'
end
validate do
if self[:ensure] != :present
return
end
if self[:project_id] && self[:project_name]
raise(Puppet::Error, <<-EOT
Please provide a value for only one of project_name and project_id.
EOT
)
end
end
end
|