Class: Staypuft::Deployment::NeutronService
Defined Under Namespace
Modules: CorePlugin, Ml2Mechanisms, NetworkSegmentation, TenantVlanRanges
Classes: Cisconexus, Jail, N1kvIpAddressValidator, NeutronVlanRangesValidator
Constant Summary
collapse
- SEGMENTATION_LIST =
['vxlan', 'vlan', 'gre', 'flat']
- VLAN_HELP =
N_('[1-4094] (e.g. 10:15)')
- ML2MECHANISM_TYPES =
:ml2_openvswitch, :ml2_l2population, :ml2_cisco_nexus
- N1KV_PARAMS =
:n1kv_vsm_ip, :n1kv_vsm_password
Instance Attribute Summary
#deployment
Class Method Summary
collapse
Instance Method Summary
collapse
#attributes=, #hostgroup, #initialize, #marked_for_destruction?
#param_attr, #param_attr_array, #param_scope
Class Method Details
.param_scope ⇒ Object
3
4
5
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 3
def self.param_scope
'neutron'
end
|
Instance Method Details
#active? ⇒ Boolean
106
107
108
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 106
def active?
deployment.networking == Deployment::Networking::NEUTRON
end
|
#cisco_nexus_mechanism? ⇒ Boolean
175
176
177
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 175
def cisco_nexus_mechanism?
self.ml2_cisco_nexus == "true"
end
|
#compute_cisco_nexus_config ⇒ Object
191
192
193
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 191
def compute_cisco_nexus_config
Hash[nexuses.map { |nexus| [nexus.hostname, nexus.config_hash] }]
end
|
#compute_ovs_bridge_mappings(host) ⇒ Object
124
125
126
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 124
def compute_ovs_bridge_mappings(host)
[*("physnet-tenants:br-#{tenant_iface(host)}" if !enable_tunneling?)]
end
|
#compute_ovs_bridge_uplinks(host) ⇒ Object
128
129
130
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 128
def compute_ovs_bridge_uplinks(host)
[*("br-#{tenant_iface(host)}:#{tenant_iface(host)}" if !enable_tunneling?)]
end
|
#compute_vlan_ranges ⇒ Object
132
133
134
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 132
def compute_vlan_ranges
[*("physnet-tenants:#{tenant_vlan_ranges}" if vlan_segmentation?)]
end
|
#core_plugin_module ⇒ Object
187
188
189
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 187
def core_plugin_module
CorePlugin::MODULES[self.core_plugin]
end
|
#enable_tunneling? ⇒ Boolean
144
145
146
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 144
def enable_tunneling?
[NetworkSegmentation::VXLAN, NetworkSegmentation::GRE].include?(network_segmentation)
end
|
#external_interface_name(host) ⇒ Object
152
153
154
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 152
def external_interface_name(host)
deployment.network_query.interface_for_host(Staypuft::SubnetType::EXTERNAL, host)
end
|
#l2population_mechanism? ⇒ Boolean
171
172
173
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 171
def l2population_mechanism?
self.ml2_l2population == "true"
end
|
#ml2_mechanisms ⇒ Object
195
196
197
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 195
def ml2_mechanisms
Ml2Mechanisms::TYPES.map { |ml2_type| ml2_type if self.send("#{ml2_type}_mechanism?") }.compact
end
|
#ml2_plugin? ⇒ Boolean
179
180
181
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 179
def ml2_plugin?
self.core_plugin == CorePlugin::ML2
end
|
#n1kv_plugin? ⇒ Boolean
183
184
185
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 183
def n1kv_plugin?
self.core_plugin == CorePlugin::N1KV
end
|
#network_segmentation_list ⇒ Object
return list of supported segmentation options with selected option at the beginning of the list
112
113
114
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 112
def network_segmentation_list
[network_segmentation, *(SEGMENTATION_LIST - [network_segmentation])]
end
|
#networker_ovs_bridge_mappings(host) ⇒ Object
116
117
118
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 116
def networker_ovs_bridge_mappings(host)
compute_ovs_bridge_mappings(host) + [*('physnet-external:br-ex' if external_interface_name(host))]
end
|
#networker_ovs_bridge_uplinks(host) ⇒ Object
120
121
122
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 120
def networker_ovs_bridge_uplinks(host)
compute_ovs_bridge_uplinks(host) + [*("br-ex:#{external_interface_name(host)}" if external_interface_name(host))]
end
|
#networker_vlan_ranges ⇒ Object
136
137
138
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 136
def networker_vlan_ranges
compute_vlan_ranges << "physnet-external"
end
|
#openvswitch_mechanism? ⇒ Boolean
167
168
169
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 167
def openvswitch_mechanism?
self.ml2_openvswitch == "true"
end
|
#ovs_tunnel_types ⇒ Object
156
157
158
159
160
161
162
163
164
165
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 156
def ovs_tunnel_types
case network_segmentation
when NetworkSegmentation::VXLAN
['vxlan']
when NetworkSegmentation::GRE
['gre']
else
[]
end
end
|
#param_hash ⇒ Object
199
200
201
202
203
204
205
206
207
208
209
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 199
def param_hash
{ 'network_segmentation' => network_segmentation,
'core_plugin' => core_plugin,
'tenant_vlan_ranges' => tenant_vlan_ranges,
'ml2_openvswitch' => ml2_openvswitch,
'ml2_l2population' => ml2_l2population,
'ml2_cisco_nexus' => ml2_cisco_nexus,
'nexuses' => nexuses,
'n1kv_vsm_ip' => n1kv_vsm_ip,
'n1kv_vsm_password' => n1kv_vsm_password }
end
|
#set_defaults ⇒ Object
98
99
100
101
102
103
104
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 98
def set_defaults
self.network_segmentation = NetworkSegmentation::VXLAN
self.core_plugin = CorePlugin::ML2
self.ml2_openvswitch = "true"
self.ml2_l2population = "true"
self.ml2_cisco_nexus = "false"
end
|
#tenant_iface(host) ⇒ Object
148
149
150
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 148
def tenant_iface(host)
deployment.network_query.interface_for_host(Staypuft::SubnetType::TENANT, host)
end
|
#vlan_segmentation? ⇒ Boolean
140
141
142
|
# File 'app/models/staypuft/deployment/neutron_service.rb', line 140
def vlan_segmentation?
network_segmentation == NetworkSegmentation::VLAN
end
|