Checkin templates.
This commit is contained in:
parent
6c53407654
commit
48a0faee8a
57
templates/havana/neutron.conf
Normal file
57
templates/havana/neutron.conf
Normal file
@ -0,0 +1,57 @@
|
||||
###############################################################################
|
||||
# [ WARNING ]
|
||||
# Configuration file maintained by Juju. Local changes may be overwritten.
|
||||
###############################################################################
|
||||
[DEFAULT]
|
||||
state_path = /var/lib/neutron
|
||||
lock_path = $state_path/lock
|
||||
bind_host = 0.0.0.0
|
||||
auth_strategy = keystone
|
||||
notification_driver = neutron.openstack.common.notifier.rpc_notifier
|
||||
{% if core_plugin -%}
|
||||
core_plugin = {{ core_plugin }}
|
||||
{% core_plugin -%}
|
||||
{% if neutron_security_groups -%}
|
||||
allow_overlapping_ips = True
|
||||
neutron_firewall_driver = {{ neutron_firewall_driver }}
|
||||
{% endif -%}
|
||||
{% if rabbitmq_host -%}
|
||||
rabbit_host = {{ rabbitmq_host }}
|
||||
rabbit_userid = {{ rabbitmq_user }}
|
||||
rabbit_password = {{ rabbitmq_password }}
|
||||
rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
||||
{% endif -%}
|
||||
|
||||
[quotas]
|
||||
quota_driver = quantum.db.quota_db.DbQuotaDriver
|
||||
{% if neutron_security_groups -%}
|
||||
quota_items = network,subnet,port,security_group,security_group_rule
|
||||
{% endif -%}
|
||||
|
||||
[agent]
|
||||
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
|
||||
[keystone_authtoken]
|
||||
signing_dir = $state_path/keystone-signing
|
||||
{% if service_host -%}
|
||||
service_protocol = {{ service_protocol }}
|
||||
service_host = {{ service_host }}
|
||||
service_port = {{ service_port }}
|
||||
auth_host = {{ auth_host }}
|
||||
auth_port = {{ auth_port }}
|
||||
auth_protocol = {{ auth_protocol }}
|
||||
admin_tenant_name = {{ admin_tenant_name }}
|
||||
admin_user = {{ admin_user }}
|
||||
admin_password = {{ admin_password }}
|
||||
signing_dir = /var/lib/cinder
|
||||
{% endif -%}
|
||||
|
||||
[database]
|
||||
{% if database_host -%}
|
||||
connection = mysql://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}
|
||||
{% else -%}
|
||||
connection = sqlite:////var/lib/neutron/neutron.sqlite
|
||||
{% endif -%}
|
||||
|
||||
[lbaas]
|
||||
[service_providers]
|
27
templates/havana/ovs_neutron_plugin.ini
Normal file
27
templates/havana/ovs_neutron_plugin.ini
Normal file
@ -0,0 +1,27 @@
|
||||
[OVS]
|
||||
tunnel_id_ranges = 1:1000
|
||||
tenant_network_type = gre
|
||||
enable_tunneling = True
|
||||
local_ip = {{ local_ip }}
|
||||
|
||||
[database]
|
||||
{% if database_host -%}
|
||||
connection = mysql://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}
|
||||
{% else -%}
|
||||
connection = sqlite:////var/lib/neutron/neutron.sqlite
|
||||
{% endif -%}
|
||||
|
||||
[keystone_authtoken]
|
||||
signing_dir = $state_path/keystone-signing
|
||||
{% if service_host -%}
|
||||
service_protocol = {{ service_protocol }}
|
||||
service_host = {{ service_host }}
|
||||
service_port = {{ service_port }}
|
||||
auth_host = {{ auth_host }}
|
||||
auth_port = {{ auth_port }}
|
||||
auth_protocol = {{ auth_protocol }}
|
||||
admin_tenant_name = {{ admin_tenant_name }}
|
||||
admin_user = {{ admin_user }}
|
||||
admin_password = {{ admin_password }}
|
||||
signing_dir = /var/lib/cinder
|
||||
{% endif -%}
|
59
templates/nova.conf
Normal file
59
templates/nova.conf
Normal file
@ -0,0 +1,59 @@
|
||||
###############################################################################
|
||||
# [ WARNING ]
|
||||
# Configuration file maintained by Juju. Local changes may be overwritten.
|
||||
###############################################################################
|
||||
[DEFAULT]
|
||||
dhcpbridge_flagfile=/etc/nova/nova.conf
|
||||
dhcpbridge=/usr/bin/nova-dhcpbridge
|
||||
logdir=/var/log/nova
|
||||
state_path=/var/lib/nova
|
||||
lock_path=/var/lock/nova
|
||||
force_dhcp_release=True
|
||||
iscsi_helper=tgtadm
|
||||
libvirt_use_virtio_for_bridges=True
|
||||
connection_type=libvirt
|
||||
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
|
||||
verbose=True
|
||||
ec2_private_dns_show_ip=True
|
||||
api_paste_config=/etc/nova/api-paste.ini
|
||||
volumes_path=/var/lib/nova/volumes
|
||||
{% if database_host -%}
|
||||
sql_connection = mysql://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}
|
||||
{% endif -%}
|
||||
{% if rabbitmq_host -%}
|
||||
rabbit_host = {{ rabbitmq_host }}
|
||||
rabbit_userid = {{ rabbitmq_user }}
|
||||
rabbit_password = {{ rabbitmq_password }}
|
||||
rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
||||
{% endif -%}
|
||||
{% if glance_api_servers -%}
|
||||
glance_api_servers = {{ glance_api_servers }}
|
||||
{% endif -%}
|
||||
{% if rbd_pool -%}
|
||||
rbd_pool = {{ rbd_pool }}
|
||||
rbd_user = {{ rbd_user }}
|
||||
rbd_secret_uuid = {{ rbd_secret_uuid }}
|
||||
{% endif -%}
|
||||
{% if quantum_plugin and quantum_plugin == 'ovs' -%}
|
||||
libvirt_vif_driver = {{ libvirt_vif_driver }}
|
||||
libvirt_user_virtio_for_bridges = True
|
||||
{% if quantum_security_groups -%}
|
||||
security_group_api = quantum
|
||||
nova_firewall_driver = nova.virt.firewall.NoopFirewallDriver
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% if network_manager_config -%}
|
||||
{% for key, value in network_manager_config.iteritems() -%}
|
||||
{{ key }} = {{ value }}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
{% if volume_service_config -%}
|
||||
{% for key, value in volume_service_config.iteritems() -%}
|
||||
{{ key }} = {{ value }}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
{% if user_config_flags -%}
|
||||
{% for key, value in user_config_flags.iteritems() -%}
|
||||
{{ key }} = {{ value }}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
134
unit_tests/test_misc_utils.py
Normal file
134
unit_tests/test_misc_utils.py
Normal file
@ -0,0 +1,134 @@
|
||||
from mock import patch, MagicMock
|
||||
from unit_tests.test_utils import CharmTestCase
|
||||
|
||||
|
||||
from charmhelpers.core import hookenv
|
||||
_conf = hookenv.config
|
||||
hookenv.config = MagicMock()
|
||||
|
||||
import hooks.misc_utils as utils
|
||||
|
||||
hookenv.config = _conf
|
||||
|
||||
TO_PATCH = [
|
||||
'apt_install',
|
||||
'filter_installed_packages',
|
||||
'config',
|
||||
'log',
|
||||
'get_os_codename_package',
|
||||
'get_os_codename_install_source',
|
||||
'relation_get',
|
||||
'unit_private_ip'
|
||||
]
|
||||
|
||||
|
||||
class NovaCCMiscUtilsTests(CharmTestCase):
|
||||
def setUp(self):
|
||||
super(NovaCCMiscUtilsTests, self).setUp(utils, TO_PATCH)
|
||||
self.config.side_effect = self.test_config.get
|
||||
self.relation_get.side_effect = self.test_relation.get
|
||||
|
||||
def _set_os_codename(self, codename):
|
||||
self.get_os_codename_package.return_value = codename
|
||||
|
||||
def test_network_manager_non_sdn(self):
|
||||
self.test_config.set('network-manager', 'FlatDHCPManager')
|
||||
self._set_os_codename('essex')
|
||||
self.assertEquals('flatdhcpmanager', utils.network_manager())
|
||||
|
||||
def test_network_manager_q_n_unsupported(self):
|
||||
self.test_config.set('network-manager', 'quantum')
|
||||
self._set_os_codename('essex')
|
||||
self.assertRaises(Exception, utils.network_manager)
|
||||
|
||||
def test_network_manager_quantum_folsom(self):
|
||||
self.test_config.set('network-manager', 'quantum')
|
||||
self._set_os_codename('folsom')
|
||||
self.assertEquals('quantum', utils.network_manager())
|
||||
|
||||
def test_network_manager_quantum_grizzly(self):
|
||||
self.test_config.set('network-manager', 'neutron')
|
||||
self._set_os_codename('grizzly')
|
||||
self.assertEquals('quantum', utils.network_manager())
|
||||
|
||||
def test_network_manager_neutron_havana(self):
|
||||
self.test_config.set('network-manager', 'neutron')
|
||||
self._set_os_codename('havana')
|
||||
self.assertEquals('neutron', utils.network_manager())
|
||||
|
||||
def test_network_manager_quantum_havana(self):
|
||||
self.test_config.set('network-manager', 'quantum')
|
||||
self._set_os_codename('havana')
|
||||
self.assertEquals('neutron', utils.network_manager())
|
||||
|
||||
@patch.object(utils, 'network_manager')
|
||||
def test_network_plugin_attribute_quantum(self, nm):
|
||||
nm.return_value = 'quantum'
|
||||
self.assertEquals(
|
||||
utils.network_plugin_attribute('ovs', 'config'),
|
||||
'/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini')
|
||||
|
||||
@patch.object(utils, 'network_manager')
|
||||
def test_network_plugin_attribute_neutron(self, nm):
|
||||
nm.return_value = 'neutron'
|
||||
self.assertEquals(
|
||||
utils.network_plugin_attribute('ovs', 'config'),
|
||||
'/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini')
|
||||
|
||||
|
||||
class NovaNeutronContextTests(CharmTestCase):
|
||||
def setUp(self):
|
||||
super(NovaNeutronContextTests, self).setUp(utils, TO_PATCH)
|
||||
self.config.side_effect = self.test_config.get
|
||||
self.relation_get.side_effect = self.test_relation.get
|
||||
self.unit_private_ip.return_value = '10.0.0.1'
|
||||
|
||||
def test_neutron_nova_context_nova_network(self):
|
||||
ctxts = [utils.NeutronContext(), utils.NeutronCCContext(),
|
||||
utils.NeutronComputeContext()]
|
||||
for ctxt in ctxts:
|
||||
self.assertEquals({}, ctxt())
|
||||
|
||||
@patch.object(utils, '_save_flag_file')
|
||||
def test_neutron_cc_context_neutron_quantum(self, ff):
|
||||
self.test_config.set('network-manager', 'Quantum')
|
||||
|
||||
ex_keys = ['core_plugin', 'local_ip',
|
||||
'network_manager', 'neutron_plugin']
|
||||
|
||||
self.get_os_codename_package.return_value = 'grizzly'
|
||||
ctxt = utils.NeutronCCContext()
|
||||
self.assertEquals(sorted(ex_keys), sorted(ctxt().iterkeys()))
|
||||
self.assertTrue(ctxt()['core_plugin'].startswith('quantum'))
|
||||
|
||||
self.test_config.set('network-manager', 'Neutron')
|
||||
self.get_os_codename_package.return_value = 'havana'
|
||||
ctxt = utils.NeutronCCContext()
|
||||
self.assertEquals(sorted(ex_keys), sorted(ctxt().iterkeys()))
|
||||
self.assertTrue(ctxt()['core_plugin'].startswith(''))
|
||||
|
||||
@patch.object(utils, '_save_flag_file')
|
||||
def test_neutron_compute_context_quantum(self, ff):
|
||||
self.test_relation.set({
|
||||
'network_manager': 'quantum',
|
||||
'quantum_plugin': 'ovs',
|
||||
'quantum_security_groups': 'yes',
|
||||
})
|
||||
|
||||
ex_keys = ['network_manager', 'neutron_security_groups',
|
||||
'neutron_firewall_driver', 'local_ip', 'core_plugin',
|
||||
'neutron_plugin', 'libvirt_vif_driver']
|
||||
|
||||
self.test_config.set('network-manager', 'Quantum')
|
||||
self.get_os_codename_package.return_value = 'folsom'
|
||||
ctxt = utils.NeutronComputeContext()
|
||||
result = ctxt()
|
||||
self.assertTrue(ctxt()['core_plugin'].startswith('quantum'))
|
||||
self.assertEquals(sorted(ex_keys), sorted(result))
|
||||
|
||||
self.test_config.set('network-manager', 'Neutron')
|
||||
self.get_os_codename_package.return_value = 'havana'
|
||||
ctxt = utils.NeutronComputeContext()
|
||||
result = ctxt()
|
||||
self.assertTrue(ctxt()['core_plugin'].startswith('neutron'))
|
||||
self.assertEquals(sorted(ex_keys), sorted(result))
|
Loading…
x
Reference in New Issue
Block a user